diff options
-rw-r--r-- | src/command_parse.cpp | 6 | ||||
-rw-r--r-- | src/commands/cmd_part.cpp | 12 | ||||
-rw-r--r-- | src/hashcomp.cpp | 2 | ||||
-rw-r--r-- | src/mode.cpp | 2 | ||||
-rw-r--r-- | src/modes/cmode_b.cpp | 20 | ||||
-rw-r--r-- | src/modules/extra/m_pgsql.cpp | 2 | ||||
-rw-r--r-- | src/modules/u_listmode.h | 6 | ||||
-rw-r--r-- | src/snomasks.cpp | 2 | ||||
-rw-r--r-- | src/xline.cpp | 2 |
9 files changed, 25 insertions, 29 deletions
diff --git a/src/command_parse.cpp b/src/command_parse.cpp index 2b75bfa9f..f05ffcd90 100644 --- a/src/command_parse.cpp +++ b/src/command_parse.cpp @@ -37,7 +37,7 @@ int InspIRCd::PassCompare(Extensible* ex, const std::string &data, const std::st return 1; /* We dont handle any hash types except for plaintext - Thanks tra26 */ - if (hashtype != "" && hashtype != "plaintext") + if (!hashtype.empty() && hashtype != "plaintext") /* See below. 1 because they dont match */ return 1; @@ -93,7 +93,7 @@ int CommandParser::LoopCall(User* user, Command* CommandObj, const std::vector<s std::vector<std::string> new_parameters(parameters); if (!items2.GetToken(extrastuff)) - extrastuff = ""; + extrastuff.clear(); new_parameters[splithere] = item; if (extra >= 0) @@ -243,7 +243,7 @@ bool CommandParser::ProcessCommand(LocalUser *user, std::string &cmd) * a * test */ - std::string lparam = ""; + std::string lparam; /* * The '-1' here is a clever trick, we'll go backwards throwing everything into a temporary param diff --git a/src/commands/cmd_part.cpp b/src/commands/cmd_part.cpp index 32cc26757..aadb42d90 100644 --- a/src/commands/cmd_part.cpp +++ b/src/commands/cmd_part.cpp @@ -48,17 +48,13 @@ CmdResult CommandPart::Handle (const std::vector<std::string>& parameters, User { if (!ServerInstance->Config->FixedPart.empty()) reason = ServerInstance->Config->FixedPart; - else - { - if (parameters.size() > 1) - reason = ServerInstance->Config->PrefixPart + parameters[1] + ServerInstance->Config->SuffixPart; - else - reason = ""; - } + else if (parameters.size() > 1) + reason = ServerInstance->Config->PrefixPart + parameters[1] + ServerInstance->Config->SuffixPart; } else { - reason = parameters.size() > 1 ? parameters[1] : ""; + if (parameters.size() > 1) + reason = parameters[1]; } if (ServerInstance->Parser->LoopCall(user, this, parameters, 0)) diff --git a/src/hashcomp.cpp b/src/hashcomp.cpp index 8a7f8987b..3fb7f84fb 100644 --- a/src/hashcomp.cpp +++ b/src/hashcomp.cpp @@ -326,7 +326,7 @@ bool irc::sepstream::GetToken(std::string &token) n++; } - token = ""; + token.clear(); return false; } diff --git a/src/mode.cpp b/src/mode.cpp index 21c9e7144..0957184b7 100644 --- a/src/mode.cpp +++ b/src/mode.cpp @@ -442,7 +442,7 @@ void ModeParser::Process(const std::vector<std::string>& parameters, User *user, continue; } - std::string parameter = ""; + std::string parameter; int pcnt = mh->GetNumParams(adding); if (pcnt && param_at == parameters.size()) { diff --git a/src/modes/cmode_b.cpp b/src/modes/cmode_b.cpp index 660b0c275..6bdd076f8 100644 --- a/src/modes/cmode_b.cpp +++ b/src/modes/cmode_b.cpp @@ -43,11 +43,11 @@ ModeAction ModeChannelBan::OnModeChange(User* source, User*, Channel* channel, s /* Call the correct method depending on wether we're adding or removing the mode */ if (adding) { - parameter = this->AddBan(source, parameter, channel, status); + this->AddBan(source, parameter, channel, status); } else { - parameter = this->DelBan(source, parameter, channel, status); + this->DelBan(source, parameter, channel, status); } /* If the method above 'ate' the parameter by reducing it to an empty string, then * it won't matter wether we return ALLOW or DENY here, as an empty string overrides @@ -105,21 +105,21 @@ std::string& ModeChannelBan::AddBan(User *user, std::string &dest, Channel *chan if ((!user) || (!chan)) { ServerInstance->Logs->Log("MODE",DEFAULT,"*** BUG *** AddBan was given an invalid parameter"); - dest = ""; + dest.clear(); return dest; } /* Attempt to tidy the mask */ ModeParser::CleanMask(dest); /* If the mask was invalid, we exit */ - if (dest == "" || dest.length() > 250) + if (dest.empty() || dest.length() > 250) return dest; long maxbans = chan->GetMaxBans(); if (IS_LOCAL(user) && ((unsigned)chan->bans.size() > (unsigned)maxbans)) { user->WriteServ("478 %s %s :Channel ban list for %s is full (maximum entries for this channel is %ld)",user->nick.c_str(), chan->name.c_str(), chan->name.c_str(), maxbans); - dest = ""; + dest.clear(); return dest; } @@ -127,7 +127,7 @@ std::string& ModeChannelBan::AddBan(User *user, std::string &dest, Channel *chan FIRST_MOD_RESULT(OnAddBan, MOD_RESULT, (user,chan,dest)); if (MOD_RESULT == MOD_RES_DENY) { - dest = ""; + dest.clear(); return dest; } @@ -136,7 +136,7 @@ std::string& ModeChannelBan::AddBan(User *user, std::string &dest, Channel *chan if (i->data == dest) { /* dont allow a user to set the same ban twice */ - dest = ""; + dest.clear(); return dest; } } @@ -153,7 +153,7 @@ std::string& ModeChannelBan::DelBan(User *user, std::string& dest, Channel *chan if ((!user) || (!chan)) { ServerInstance->Logs->Log("MODE",DEFAULT,"*** BUG *** TakeBan was given an invalid parameter"); - dest = ""; + dest.clear(); return dest; } @@ -165,14 +165,14 @@ std::string& ModeChannelBan::DelBan(User *user, std::string& dest, Channel *chan FIRST_MOD_RESULT(OnDelBan, MOD_RESULT, (user, chan, dest)); if (MOD_RESULT == MOD_RES_DENY) { - dest = ""; + dest.clear(); return dest; } chan->bans.erase(i); return dest; } } - dest = ""; + dest.clear(); return dest; } diff --git a/src/modules/extra/m_pgsql.cpp b/src/modules/extra/m_pgsql.cpp index 1e2ef56ea..71f494dd9 100644 --- a/src/modules/extra/m_pgsql.cpp +++ b/src/modules/extra/m_pgsql.cpp @@ -331,7 +331,7 @@ restart: } else { - qinprog.q = ""; + qinprog.q.clear(); } } else diff --git a/src/modules/u_listmode.h b/src/modules/u_listmode.h index c6e1f9add..dde36a482 100644 --- a/src/modules/u_listmode.h +++ b/src/modules/u_listmode.h @@ -303,7 +303,7 @@ class ListModeBase : public ModeHandler source->WriteNumeric(478, "%s %s %s :Channel ban/ignore list is full", source->nick.c_str(), channel->name.c_str(), parameter.c_str()); } - parameter = ""; + parameter.clear(); return MODEACTION_DENY; } else @@ -325,14 +325,14 @@ class ListModeBase : public ModeHandler } /* Tried to remove something that wasn't set */ TellNotSet(source, channel, parameter); - parameter = ""; + parameter.clear(); return MODEACTION_DENY; } else { /* Hmm, taking an exception off a non-existant list, DIE */ TellNotSet(source, channel, parameter); - parameter = ""; + parameter.clear(); return MODEACTION_DENY; } } diff --git a/src/snomasks.cpp b/src/snomasks.cpp index 4953212a0..4b9c9d86b 100644 --- a/src/snomasks.cpp +++ b/src/snomasks.cpp @@ -163,7 +163,7 @@ void Snomask::Flush() } } - LastMessage = ""; + LastMessage.clear(); LastBlocked = false; Count = 0; } diff --git a/src/xline.cpp b/src/xline.cpp index 6ec0723ec..12948959b 100644 --- a/src/xline.cpp +++ b/src/xline.cpp @@ -241,7 +241,7 @@ IdentHostPair XLineManager::IdentSplit(const std::string &ident_and_host) } else { - n.first = ""; + n.first.clear(); n.second = ident_and_host; } |