From 3ae2ad7553e2a12ecf5804f03f5943206f548770 Mon Sep 17 00:00:00 2001 From: brain Date: Mon, 27 Feb 2006 03:12:21 +0000 Subject: Improved speed (not using strlen, take loop count) git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3360 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/message.cpp | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/message.cpp b/src/message.cpp index 584d5a070..436cc1ed3 100644 --- a/src/message.cpp +++ b/src/message.cpp @@ -235,12 +235,7 @@ void ChangeDisplayedHost(userrec* user, const char* host) int isident(const char* n) { - if (!n) - - { - return 0; - } - if (!strcmp(n,"")) + if (!n || !*n) { return 0; } @@ -266,11 +261,8 @@ int isnick(const char* n) { return 0; } - if (strlen(n) > NICKMAX-1) - { - return 0; - } - for (char* i = (char*)n; *i; i++) + int p = 0; + for (char* i = (char*)n; *i; i++, p++) { /* can occur anywhere in a nickname */ if ((*i >= 'A') && (*i <= '}')) @@ -285,7 +277,7 @@ int isnick(const char* n) /* invalid character! abort */ return 0; } - return 1; + return (p < NICKMAX - 1); } /* returns the status character for a given user on a channel, e.g. @ for op, -- cgit v1.2.3