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
commitd7bfd54a3d71467a94fb6be95e3db822225cc63c (patch)
treea086b2427b7b866fcd2b443ad6263ee2dc19845c /src/ini.cpp
parente3fad31f31455816b1a3cc205f989ec8fcdde3b5 (diff)
downloadopenttd-d7bfd54a3d71467a94fb6be95e3db822225cc63c.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);