From 0974364c1a67edaffec275c5a65e72ba8289ac02 Mon Sep 17 00:00:00 2001 From: om Date: Thu, 30 Mar 2006 22:14:51 +0000 Subject: Make chlist() use an ostringstream, should be faster git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3790 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/message.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'src/message.cpp') diff --git a/src/message.cpp b/src/message.cpp index e9d634e76..655591607 100644 --- a/src/message.cpp +++ b/src/message.cpp @@ -401,12 +401,10 @@ char lst[MAXBUF]; std::string chlist(userrec *user,userrec* source) { /* Should this be a stringstream? Not sure if it would be faster as streams are more oriented at appending stuff, which is all we do */ - std::string lst; + std::ostringstream list; if (!user || !source) - { - return lst; - } + return ""; for (std::vector::const_iterator i = user->chans.begin(); i != user->chans.end(); i++) { @@ -422,13 +420,11 @@ std::string chlist(userrec *user,userrec* source) // if the user is the same as the source or is an oper, shortcircuit the comparison. if ((source == user) || (*source->oper && Config->OperSpyWhois) || (((!rec->channel->modes[CM_PRIVATE]) && (!rec->channel->modes[CM_SECRET]) && !(user->modebits & UM_INVISIBLE)) || (rec->channel->HasUser(source)))) { - lst += cmode(user, rec->channel); - lst += rec->channel->name; - lst += " "; + list << cmode(user, rec->channel) << rec->channel->name << " "; } //} } } - return lst; + return list.str(); } -- cgit v1.2.3