From c1077faa281c5635f85b892e605e23bd6c8fcc3b Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 13 Dec 2012 06:12:56 -0500 Subject: Optimize much of the database code and serialize code. --- modules/commands/cs_set_misc.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'modules/commands/cs_set_misc.cpp') diff --git a/modules/commands/cs_set_misc.cpp b/modules/commands/cs_set_misc.cpp index 3bf0e9bbd..1fb25c79a 100644 --- a/modules/commands/cs_set_misc.cpp +++ b/modules/commands/cs_set_misc.cpp @@ -22,20 +22,22 @@ struct CSMiscData : ExtensibleItem, Serializable { } - Serialize::Data Serialize() const anope_override + void Serialize(Serialize::Data &sdata) const anope_override { - Serialize::Data sdata; - sdata["ci"] << this->ci->name; sdata["name"] << this->name; sdata["data"] << this->data; - - return sdata; } static Serializable* Unserialize(Serializable *obj, Serialize::Data &data) { - ChannelInfo *ci = ChannelInfo::Find(data["ci"].astr()); + Anope::string sci, sname, sdata; + + data["ci"] >> sci; + data["name"] >> sname; + data["data"] >> sdata; + + ChannelInfo *ci = ChannelInfo::Find(sci); if (ci == NULL) return NULL; @@ -49,8 +51,8 @@ struct CSMiscData : ExtensibleItem, Serializable } else { - d = new CSMiscData(ci, data["name"].astr(), data["data"].astr()); - ci->Extend(data["name"].astr(), d); + d = new CSMiscData(ci, sname, sdata); + ci->Extend(sname, d); } return d; -- cgit