diff options
author | Adam <Adam@anope.org> | 2012-12-13 06:12:56 -0500 |
---|---|---|
committer | Adam <Adam@anope.org> | 2012-12-13 06:12:56 -0500 |
commit | c1077faa281c5635f85b892e605e23bd6c8fcc3b (patch) | |
tree | 213b5f87a19f182e1efd6110f03ff10d5b10ebf6 /modules/commands/os_dns.cpp | |
parent | 76ba147c22944b67e8522cd2bb7b6e1bae498ced (diff) |
Optimize much of the database code and serialize code.
Diffstat (limited to 'modules/commands/os_dns.cpp')
-rw-r--r-- | modules/commands/os_dns.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/modules/commands/os_dns.cpp b/modules/commands/os_dns.cpp index 769a42f26..6e5689396 100644 --- a/modules/commands/os_dns.cpp +++ b/modules/commands/os_dns.cpp @@ -49,17 +49,13 @@ class DNSServer : public Serializable } - Serialize::Data Serialize() const anope_override + void Serialize(Serialize::Data &data) const anope_override { - Serialize::Data data; - data["server_name"] << server_name; for (unsigned i = 0; i < ips.size(); ++i) data["ip" + stringify(i)] << ips[i]; data["limit"] << limit; data["pooled"] << pooled; - - return data; } static Serializable* Unserialize(Serializable *obj, Serialize::Data &data) @@ -72,12 +68,16 @@ class DNSServer : public Serializable req = new DNSServer(); data["server_name"] >> req->server_name; - for (unsigned i = 0; data.count("ip" + stringify(i)); ++i) + + for (unsigned i = 0; true; ++i) { Anope::string ip_str; data["ip" + stringify(i)] >> ip_str; + if (ip_str.empty()) + break; req->ips.push_back(ip_str); } + data["limit"] >> req->limit; data["pooled"] >> req->pooled; |