From 0161215f42ccbfe45d1aef626f830d39486ef699 Mon Sep 17 00:00:00 2001 From: brain Date: Sat, 9 Jun 2007 12:10:12 +0000 Subject: Change some = "" to clear() and some == "" to .empty() git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7263 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/channels.cpp | 6 +++--- src/cmd_oper.cpp | 2 +- src/cmd_rehash.cpp | 2 +- src/configreader.cpp | 2 +- src/hashcomp.cpp | 6 +++--- src/helperfuncs.cpp | 4 ++-- src/inspircd.cpp | 6 +++--- src/inspsocket.cpp | 2 +- src/mode.cpp | 12 ++++++------ src/modules.cpp | 6 +++--- src/userprocess.cpp | 2 +- src/users.cpp | 10 +++++----- 12 files changed, 30 insertions(+), 30 deletions(-) (limited to 'src') diff --git a/src/channels.cpp b/src/channels.cpp index 7629c8bb6..b44a863b4 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -188,7 +188,7 @@ void chanrec::SetDefaultModes() if (mode->GetNumParams(true)) parameter = list.GetToken().c_str(); else - parameter = ""; + parameter.clear(); mode->OnModeChange(dummyuser, dummyuser, this, parameter, true); } @@ -790,7 +790,7 @@ char* chanrec::ChanModes(bool showkey) if(this->modes[n]) { *offset++ = n + 65; - extparam = ""; + extparam.clear(); switch (n) { case CM_KEY: @@ -811,7 +811,7 @@ char* chanrec::ChanModes(bool showkey) extparam = this->GetModeParameter(n + 65); break; } - if (extparam != "") + if (!extparam.empty()) { charlcat(sparam,' ',MAXBUF); strlcat(sparam,extparam.c_str(),MAXBUF); diff --git a/src/cmd_oper.cpp b/src/cmd_oper.cpp index fd0af1ba5..686182876 100644 --- a/src/cmd_oper.cpp +++ b/src/cmd_oper.cpp @@ -115,7 +115,7 @@ CmdResult cmd_oper::Handle (const char** parameters, int pcnt, userrec *user) if (!type_invalid) { - std::string fields = ""; + std::string fields; if (!match_login) fields.append("login "); if (!match_pass) diff --git a/src/cmd_rehash.cpp b/src/cmd_rehash.cpp index b856fa888..34789b0ea 100644 --- a/src/cmd_rehash.cpp +++ b/src/cmd_rehash.cpp @@ -27,7 +27,7 @@ extern "C" DllExport command_t* init_command(InspIRCd* Instance) CmdResult cmd_rehash::Handle (const char** parameters, int pcnt, userrec *user) { user->WriteServ("382 %s %s :Rehashing",user->nick,ServerConfig::CleanFilename(ServerInstance->ConfigFileName)); - std::string parameter = ""; + std::string parameter; std::string old_disabled = ServerInstance->Config->DisabledCommands; if (pcnt) { diff --git a/src/configreader.cpp b/src/configreader.cpp index 2d62f354a..35d8bc927 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -129,7 +129,7 @@ void ServerConfig::Update005() char buf[MAXBUF]; snprintf(buf, MAXBUF, "%s:are supported by this server", line5.c_str()); isupport.push_back(buf); - line5 = ""; + line5.clear(); token_counter = 0; } } diff --git a/src/hashcomp.cpp b/src/hashcomp.cpp index 3ab91531f..0a7264576 100644 --- a/src/hashcomp.cpp +++ b/src/hashcomp.cpp @@ -211,7 +211,7 @@ bool irc::tokenstream::GetToken(std::string &token) n++; } - token = ""; + token.clear(); return false; } @@ -433,14 +433,14 @@ long irc::portparser::GetToken() std::string x = sep->GetToken(); - if (x == "") + if (x.empty()) return 0; while (Overlaps(atoi(x.c_str()))) { x = sep->GetToken(); - if (x == "") + if (x.empty()) return 0; } diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp index 5aeabfd8b..f5d9aa5d9 100644 --- a/src/helperfuncs.cpp +++ b/src/helperfuncs.cpp @@ -81,7 +81,7 @@ std::string InspIRCd::GetServerDescription(const char* servername) FOREACH_MOD_I(this,I_OnGetServerDescription,OnGetServerDescription(servername,description)); - if (description != "") + if (!description.empty()) { return description; } @@ -435,7 +435,7 @@ void InspIRCd::OpenLog(char** argv, int argc) if (!*this->LogFileName) { - if (Config->logpath == "") + if (Config->logpath.empty()) { Config->logpath = Config->MyDir + "/ircd.log"; } diff --git a/src/inspircd.cpp b/src/inspircd.cpp index 82b209360..062b89782 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -1231,7 +1231,7 @@ void FileLogger::WriteLogLine(const std::string &line) else { /* Wrote the whole buffer, and no need for write callback */ - buffer = ""; + buffer.clear(); } #endif if (writeops++ % 20) @@ -1262,7 +1262,7 @@ void FileLogger::Close() fclose(log); } - buffer = ""; + buffer.clear(); } FileLogger::FileLogger(InspIRCd* Instance, FILE* logfile) : ServerInstance(Instance), log(logfile), writeops(0) @@ -1271,7 +1271,7 @@ FileLogger::FileLogger(InspIRCd* Instance, FILE* logfile) : ServerInstance(Insta { irc::sockets::NonBlocking(fileno(log)); this->SetFd(fileno(log)); - buffer = ""; + buffer.clear(); } } diff --git a/src/inspsocket.cpp b/src/inspsocket.cpp index 80e916c00..63964c1ea 100644 --- a/src/inspsocket.cpp +++ b/src/inspsocket.cpp @@ -177,7 +177,7 @@ bool InspSocket::BindAddr(const std::string &ip) std::string IP = ip.empty() ? Conf.ReadValue("bind","address",j) : ip; if (!ip.empty() || Conf.ReadValue("bind","type",j) == "servers") { - if (!ip.empty() || ((IP != "*") && (IP != "127.0.0.1") && (IP != "") && (IP != "::1"))) + if (!ip.empty() || ((IP != "*") && (IP != "127.0.0.1") && (!IP.empty()) && (IP != "::1"))) { sockaddr* s = new sockaddr[2]; #ifdef IPV6 diff --git a/src/mode.cpp b/src/mode.cpp index 874d8bef4..c38874229 100644 --- a/src/mode.cpp +++ b/src/mode.cpp @@ -280,7 +280,7 @@ void ModeParser::Process(const char** parameters, int pcnt, userrec *user, bool chanrec* targetchannel = ServerInstance->FindChan(parameters[0]); userrec* targetuser = ServerInstance->FindNick(parameters[0]); - LastParse = ""; + LastParse.clear(); /* Special case for displaying the list for listmodes, * e.g. MODE #chan b, or MODE #chan +b without a parameter @@ -411,9 +411,9 @@ void ModeParser::Process(const char** parameters, int pcnt, userrec *user, bool } std::string mode_sequence = parameters[1]; - std::string parameter = ""; + std::string parameter; std::ostringstream parameter_list; - std::string output_sequence = ""; + std::string output_sequence; bool adding = true, state_change = false; unsigned char handler_id = 0; int parameter_counter = 2; /* Index of first parameter */ @@ -905,8 +905,8 @@ bool ModeParser::PrefixComparison(prefixtype one, prefixtype two) std::string ModeParser::BuildPrefixes() { - std::string mletters = ""; - std::string mprefixes = ""; + std::string mletters; + std::string mprefixes; pfxcontainer pfx; std::map prefix_to_mode; @@ -1046,7 +1046,7 @@ ModeParser::ModeParser(InspIRCd* Instance) : ServerInstance(Instance) memset(modewatchers, 0, sizeof(modewatchers)); /* Last parse string */ - LastParse = ""; + LastParse.clear(); /* Initialise the RFC mode letters */ for (int index = 0; modes[index].modechar; index++) diff --git a/src/modules.cpp b/src/modules.cpp index b36b28a13..43ae14385 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -329,7 +329,7 @@ std::pair InspIRCd::GetInterfaceInstanceCount(Module* m) const std::string& InspIRCd::GetModuleName(Module* m) { - static std::string nothing = ""; /* Prevent compiler warning */ + static std::string nothing; /* Prevent compiler warning */ if (!this->GetModuleCount()) return nothing; @@ -403,7 +403,7 @@ void InspIRCd::SendMode(const char** parameters, int pcnt, userrec *user) void InspIRCd::DumpText(userrec* User, const std::string &LinePrefix, stringstream &TextStream) { std::string CompleteLine = LinePrefix; - std::string Word = ""; + std::string Word; while (TextStream >> Word) { if (CompleteLine.length() + Word.length() + 3 > 500) @@ -674,7 +674,7 @@ FileReader::FileReader(InspIRCd* Instance) : ServerInstance(Instance) std::string FileReader::Contents() { - std::string x = ""; + std::string x; for (file_cache::iterator a = this->fc.begin(); a != this->fc.end(); a++) { x.append(*a); diff --git a/src/userprocess.cpp b/src/userprocess.cpp index ed372ab15..9240733a0 100644 --- a/src/userprocess.cpp +++ b/src/userprocess.cpp @@ -117,7 +117,7 @@ void InspIRCd::ProcessUser(userrec* cu) else { current->WriteServ("NOTICE %s :Your previous line was too long and was not delivered (Over %d chars) Please shorten it.", current->nick, MAXBUF-2); - current->recvq = ""; + current->recvq.clear(); } } else diff --git a/src/users.cpp b/src/users.cpp index 2e3bc83d5..7e0851f59 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -330,9 +330,9 @@ userrec::userrec(InspIRCd* Instance) : ServerInstance(Instance) ChannelCount = timeout = flood = bytes_in = bytes_out = cmds_in = cmds_out = 0; muted = exempt = haspassed = dns_done = false; fd = -1; - recvq = ""; - sendq = ""; - WriteError = ""; + recvq.clear(); + sendq.clear(); + WriteError.clear(); res_forward = res_reverse = NULL; Visibility = NULL; ip = NULL; @@ -632,7 +632,7 @@ bool userrec::BufferIsReady() void userrec::ClearBuffer() { - recvq = ""; + recvq.clear(); } std::string userrec::GetBuffer() @@ -713,7 +713,7 @@ void userrec::FlushWriteBuf() { if ((this->fd == FD_MAGIC_NUMBER) || (*this->GetWriteError())) { - sendq = ""; + sendq.clear(); } if ((sendq.length()) && (this->fd != FD_MAGIC_NUMBER)) { -- cgit v1.2.3