summaryrefslogtreecommitdiff
path: root/src/ini_load.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ini_load.cpp')
-rw-r--r--src/ini_load.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/ini_load.cpp b/src/ini_load.cpp
index 308f822be..0663ef1e4 100644
--- a/src/ini_load.cpp
+++ b/src/ini_load.cpp
@@ -101,6 +101,29 @@ IniItem *IniGroup::GetItem(const std::string &name, bool create)
}
/**
+ * Remove the item with the given name.
+ * @param name Name of the item to remove.
+ */
+void IniGroup::RemoveItem(const std::string &name)
+{
+ IniItem **prev = &this->item;
+
+ for (IniItem *item = this->item; item != nullptr; prev = &item->next, item = item->next) {
+ if (item->name != name) continue;
+
+ *prev = item->next;
+ if (this->last_item == &this->item) {
+ this->last_item = &item->next;
+ }
+
+ item->next = nullptr;
+ delete item;
+
+ return;
+ }
+}
+
+/**
* Clear all items in the group
*/
void IniGroup::Clear()