summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-02-27 03:12:21 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-02-27 03:12:21 +0000
commit3ae2ad7553e2a12ecf5804f03f5943206f548770 (patch)
tree66467cd502c8a6c178b3432bdff744a1cb44bd71 /src
parent8918c3fb8b8eab39e7d1d42d7bccfa444cfc3176 (diff)
Improved speed (not using strlen, take loop count)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3360 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/message.cpp16
1 files 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,