diff options
| author | Adam <Adam@anope.org> | 2016-07-28 22:45:37 -0400 |
|---|---|---|
| committer | Adam <Adam@anope.org> | 2016-07-28 22:45:37 -0400 |
| commit | 104dcb745de20ba6f4b4ab73a53841c6d52c715f (patch) | |
| tree | d78f7f879da4e6ba0c97010643dc1ac132917af0 /include | |
| parent | aeb8f29438358a07cc62f167456d6f04a8c84668 (diff) | |
Get rid of undefined behavior in configuration blocks by creating them as necessary, add templated set function
Diffstat (limited to 'include')
| -rw-r--r-- | include/config.h | 9 | ||||
| -rw-r--r-- | include/serialize.h | 2 |
2 files changed, 8 insertions, 3 deletions
diff --git a/include/config.h b/include/config.h index 84f47ecb3..94ddb7e91 100644 --- a/include/config.h +++ b/include/config.h @@ -35,7 +35,8 @@ namespace Configuration Block(const Anope::string &); const Anope::string &GetName() const; int CountBlock(const Anope::string &name); - Block* GetBlock(const Anope::string &name, int num = 0); + Block* GetBlock(const Anope::string &name); + Block* GetBlock(const Anope::string &name, int num); template<typename T> inline T Get(const Anope::string &tag) { @@ -56,7 +57,11 @@ namespace Configuration return T(); } - bool Set(const Anope::string &tag, const Anope::string &value); + template<typename T> void Set(const Anope::string &tag, const T &value) + { + Set(tag, stringify(value)); + } + const item_map* GetItems() const; }; diff --git a/include/serialize.h b/include/serialize.h index 3ee9ce376..949866dec 100644 --- a/include/serialize.h +++ b/include/serialize.h @@ -566,7 +566,7 @@ class Serialize::Field : public CommonFieldBase<TypeImpl, T> { } - T GetField(TypeImpl *s) + T GetField(TypeImpl *s) override { T* t = this->Get_(s); |
