summaryrefslogtreecommitdiff
path: root/src/ini.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-08-25 06:35:28 +0000
committerrubidium <rubidium@openttd.org>2008-08-25 06:35:28 +0000
commit411c65e755eb6dd2e1412d2edb0f811ebd5ce73d (patch)
treea086b2427b7b866fcd2b443ad6263ee2dc19845c /src/ini.cpp
parent6e4d8a273e655372cdd1c5a1834cbb947381885f (diff)
downloadopenttd-411c65e755eb6dd2e1412d2edb0f811ebd5ce73d.tar.xz
(svn r14164) -Codechange: simplify and unify the addition of ini items with value when not loading an ini file.
-Fix: wrong insertion management causing leaks.
Diffstat (limited to 'src/ini.cpp')
-rw-r--r--src/ini.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/ini.cpp b/src/ini.cpp
index 86cceaa42..c72addd65 100644
--- a/src/ini.cpp
+++ b/src/ini.cpp
@@ -19,6 +19,14 @@ IniItem::IniItem(IniGroup *parent, const char *name, size_t len) : next(NULL), v
parent->last_item = &this->next;
}
+IniItem::IniItem(IniGroup *parent, const char *name, const char *value) : next(NULL), comment(NULL)
+{
+ this->name = strdup(name);
+ this->value = strdup(value);
+ *parent->last_item = this;
+ parent->last_item = &this->next;
+}
+
IniItem::~IniItem()
{
free(this->name);