X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmessage.cpp;h=8adf507938f488ac03eb68300731e5010d9d1ca6;hb=d56539c9abbc2165b29f88c5f62f712497de069b;hp=8c03e85f2072d8dc788f6f4aca61c788a89f09ef;hpb=2bb2422bfc4a0dd02a45bad4578a0aeb48f0b4ad;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/message.cpp b/src/message.cpp index 8c03e85f2..8adf50793 100644 --- a/src/message.cpp +++ b/src/message.cpp @@ -87,32 +87,35 @@ int common_channels(userrec *u, userrec *u2) return 0; } - void tidystring(char* str) { // strips out double spaces before a : parameter - + char temp[MAXBUF]; bool go_again = true; - + if (!str) - { return; - } - - while ((str[0] == ' ') && (strlen(str)>0)) - { + + // pointer voodoo++ --w00t + while ((*str) && (*str == ' ')) str++; - } - + while (go_again) { bool noparse = false; unsigned int t = 0, a = 0; go_again = false; - while (a < strlen(str)) + const int lenofstr = strlen(str); + + /* + * by caching strlen() of str, we theoretically avoid 3 expensive calls each time this loop + * rolls around.. should speed things up a nanosecond or two. ;) + */ + + while (a < lenofstr) { - if ((a