[[project @ 2005-06-30 02:51:27 by unknown_lamer] unknown_lamer**20050630025127 Tiny speedup in Socket code. ] { hunk ./ChangeLog 2 + + * bobot++.texinfo: Updated copyright years, changed "applies to + 2.1.5" to 2.2 + + * source/Socket.C (readLine): return buf.substr (0, pos) instead + of using the String char * constructor (this should be faster, + especially for long strings since a simple copy is used instead of + going over each char until nul is encountered) hunk ./bobot++.texinfo 45 -This document applies to version 2.1.5 of the program named +This document applies to version 2.2 of the program named hunk ./bobot++.texinfo 48 -Copyright 2002,2004 Clinton Ebadi +Copyright 2002,2004,2005 Clinton Ebadi hunk ./source/Channel.C 17 -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +// 02110-1301, USA. hunk ./source/Channel.H 17 -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +// 02110-1301, USA. hunk ./source/ChannelList.H 17 -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +// 02110-1301, USA. hunk ./source/Parser.C 17 -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +// 02110-1301, USA. hunk ./source/Person.C 17 -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +// 02110-1301, USA. hunk ./source/Person.H 16 -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +// 02110-1301, USA. hunk ./source/Socket.C 2 -// Copyright (C) 2002 Clinton Ebadi +// Copyright (C) 2002,2005 Clinton Ebadi hunk ./source/Socket.C 17 -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +// 02110-1301, USA. hunk ./source/Socket.C 296 - buf[pos-2] = '\0'; + { + buf[pos-2] = '\0'; + return String (buf.substr (0, pos - 2)); + } hunk ./source/Socket.C 301 - buf[pos-1] = '\0'; - - // c_str () is used because the String constructor for std::string - // will copy the entire std::string into it when we only want it to - // copy up to the first null. - return String (buf.c_str ()); + { + buf[pos-1] = '\0'; + return String (buf.substr (0, pos - 1)); + } hunk ./source/User.C 16 -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +// 02110-1301, USA. hunk ./source/UserCommands.C 585 - std::map >::iterator it; - for (it = cnx->bot->userFunctions.begin(); it != cnx->bot->userFunctions.end(); ++it) - if ((*it).second->minLevel <= level) { - result = result + (*it).first + " "; - length += (*it).first.length() + 1; - if (length >= 256) { - from->sendNotice(result); - result = ""; length = 0; - } - } + std::map >::iterator it; + + for (it = cnx->bot->userFunctions.begin(); + it != cnx->bot->userFunctions.end(); ++it) + { + if ((*it).second->minLevel <= level) + { + result = result + (*it).first + " "; + length += (*it).first.length() + 1; + + if (length >= 256) + { + from->sendNotice(result); + result = ""; length = 0; + } + } + } hunk ./source/UserList.C 17 -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +// 02110-1301, USA. hunk ./source/UserList.H 17 -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +// 02110-1301, USA. }