From 8e4002dc82b45344b2f8d90000d10eb9a904b1bc Mon Sep 17 00:00:00 2001 From: Maxim Mamontov Date: Sun, 15 Sep 2013 04:30:53 +0300 Subject: [PATCH] [NY] Code deduplication. --- projects/sgconf/common_sg.cpp | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/projects/sgconf/common_sg.cpp b/projects/sgconf/common_sg.cpp index 06fd9823..1db7c9c4 100644 --- a/projects/sgconf/common_sg.cpp +++ b/projects/sgconf/common_sg.cpp @@ -294,14 +294,7 @@ void ConvertFromKOI8(const std::string & src, std::string * dst) ConvertKOI8(src, dst, FROM_KOI8); } //----------------------------------------------------------------------------- -void SendMessageCallback(bool result, const std::string & reason, void * d) -{ -ResultData * data = static_cast(d); -data->result = result; -data->reason = reason; -} -//----------------------------------------------------------------------------- -void RecvSetUserAnswer(bool result, const std::string & reason, void * d) +void ResultCallback(bool result, const std::string & reason, void * d) { ResultData * data = static_cast(d); data->result = result; @@ -447,7 +440,7 @@ bool ProcessSetUser(const std::string & server, SERVCONF sc(server, port, login, password); ResultData data; -int res = sc.ChgUser(str.c_str(), RecvSetUserAnswer, &data); +int res = sc.ChgUser(str.c_str(), ResultCallback, &data); if (res == st_ok && data.result) { @@ -470,7 +463,7 @@ bool ProcessSendMessage(const std::string & server, uint16_t port, SERVCONF sc(server, port, login, password); ResultData data; -int res = sc.SendMessage(requestString.c_str(), SendMessageCallback, &data); +int res = sc.SendMessage(requestString.c_str(), ResultCallback, &data); if (res == st_ok && data.result) { -- 2.44.2