Changeset - r28006:7835d82043ea
[Not reviewed]
master
0 2 0
Peter Nelson - 13 months ago 2023-10-11 11:31:12
peter1138@openttd.org
Codechange: Accept std::string in RemoveGroup().
2 files changed with 3 insertions and 3 deletions:
0 comments (0 inline, 0 general)
src/ini_load.cpp
Show inline comments
 
@@ -186,15 +186,15 @@ IniGroup *IniLoadFile::GetGroup(const st
 
}
 

	
 
/**
 
 * Remove the group with the given name.
 
 * @param name name of the group to remove.
 
 */
 
void IniLoadFile::RemoveGroup(const char *name)
 
void IniLoadFile::RemoveGroup(const std::string &name)
 
{
 
	size_t len = strlen(name);
 
	size_t len = name.length();
 
	IniGroup *prev = nullptr;
 
	IniGroup *group;
 

	
 
	/* does it exist already? */
 
	for (group = this->group; group != nullptr; prev = group, group = group->next) {
 
		if (group->name.compare(0, len, name) == 0) {
src/ini_type.h
Show inline comments
 
@@ -59,13 +59,13 @@ struct IniLoadFile {
 
	const char * const *seq_group_names;  ///< nullptr terminated list with group names that are sequences.
 

	
 
	IniLoadFile(const char * const *list_group_names = nullptr, const char * const *seq_group_names = nullptr);
 
	virtual ~IniLoadFile();
 

	
 
	IniGroup *GetGroup(const std::string &name, bool create_new = true);
 
	void RemoveGroup(const char *name);
 
	void RemoveGroup(const std::string &name);
 

	
 
	void LoadFromDisk(const std::string &filename, Subdirectory subdir);
 

	
 
	/**
 
	 * Open the INI file.
 
	 * @param filename Name of the INI file.
0 comments (0 inline, 0 general)