summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2014-09-02 16:27:12 +0200
committerAttila Molnar <attilamolnar@hush.com>2014-09-02 16:27:12 +0200
commit0140bc21056b4c7f6ede16cdbf0563b0af566dbf (patch)
treeb6aa51f290f8c361d1fcb9cd956e283b3a1ccf02
parent5f05a6b916d84ef620fbc750c3346bf50eafd69a (diff)
Replace stringstream with a std::string in ModeParser::Process()
There is no benefit in using a stringstream here
-rw-r--r--src/mode.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/mode.cpp b/src/mode.cpp
index 3fcfcbd51..d24346e59 100644
--- a/src/mode.cpp
+++ b/src/mode.cpp
@@ -406,7 +406,7 @@ void ModeParser::Process(const std::vector<std::string>& parameters, User* user,
std::string mode_sequence = parameters[1];
std::string output_mode;
- std::ostringstream output_parameters;
+ std::string output_parameters;
LastParseParams.push_back(output_mode);
LastParseTranslate.push_back(TR_TEXT);
@@ -469,12 +469,13 @@ void ModeParser::Process(const std::vector<std::string>& parameters, User* user,
if (pcnt)
{
- output_parameters << " " << parameter;
+ output_parameters.push_back(' ');
+ output_parameters.append(parameter);
LastParseParams.push_back(parameter);
LastParseTranslate.push_back(mh->GetTranslateType());
}
- if ( (output_mode.length() + output_parameters.str().length() > 450)
+ if ((output_mode.length() + output_parameters.length() > 450)
|| (output_mode.length() > 100)
|| (LastParseParams.size() > ServerInstance->Config->Limits.MaxModes))
{
@@ -490,7 +491,7 @@ void ModeParser::Process(const std::vector<std::string>& parameters, User* user,
LastParse = targetchannel ? targetchannel->name : targetuser->nick;
LastParse.append(" ");
LastParse.append(output_mode);
- LastParse.append(output_parameters.str());
+ LastParse.append(output_parameters);
if (!(flags & MODE_LOCALONLY))
ServerInstance->PI->SendMode(user, targetuser, targetchannel, LastParseParams, LastParseTranslate);