diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-03-09 18:18:18 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-03-09 18:18:18 +0000 |
commit | 9fd6aff54fa4b554a45841e2f13b401cb34466ab (patch) | |
tree | ba9d4cc193f325c2990c4976c36701712730db47 | |
parent | 797c8ac76967a1b0a3fc61b55cf4d3903f019f9a (diff) |
Strlen bashing.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3600 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r-- | src/modules/m_antibottler.cpp | 5 | ||||
-rw-r--r-- | src/modules/m_helpop.cpp | 8 | ||||
-rw-r--r-- | src/modules/m_ident.cpp | 9 |
3 files changed, 6 insertions, 16 deletions
diff --git a/src/modules/m_antibottler.cpp b/src/modules/m_antibottler.cpp index 3c0f4e67b..89effc607 100644 --- a/src/modules/m_antibottler.cpp +++ b/src/modules/m_antibottler.cpp @@ -72,11 +72,6 @@ class ModuleAntiBottler : public Module if (!(data) || !(*data)) return; - /* - * slight efficiency fix: strtok() just returns NULL if it has no more - * tokens to return. Plus strlen's here really could have been replaced - * with above pointer voodoo :-). --w00t - */ strtok(data," "); char *ident = strtok(NULL," "); char *local = strtok(NULL," "); diff --git a/src/modules/m_helpop.cpp b/src/modules/m_helpop.cpp index a76cb87a8..fce9489b2 100644 --- a/src/modules/m_helpop.cpp +++ b/src/modules/m_helpop.cpp @@ -122,16 +122,12 @@ bool do_helpop(char **parameters, int pcnt, userrec *src) search++; } - /* XXX - don't we have an strtolower()? if not, might pay to add one.. that works on char *, preferably.. */ - strlcpy(lower, search, MAXBUF); - for (unsigned int t = 0; t < strlen(lower); t++) - lower[t] = tolower(lower[t]); - + strlower(search); for (int i = 1; output != ""; i++) { snprintf(a,MAXBUF,"line%d",i); - output = helpop->ReadValue(lower, a, 0); + output = helpop->ReadValue(search, a, 0); if (output != "") { Srv->SendTo(NULL,src,"290 "+std::string(src->nick)+" :"+output); diff --git a/src/modules/m_ident.cpp b/src/modules/m_ident.cpp index 821576df8..a4a7fa34c 100644 --- a/src/modules/m_ident.cpp +++ b/src/modules/m_ident.cpp @@ -71,11 +71,10 @@ class RFC1413 : public InspSocket if (section) { while (*section == ' ') section++; // strip leading spaces - int t = strlen(section); - for (int j = 0; j < t; j++) - if ((section[j] < 33) || (section[j]>126)) - section[j] = '\0'; // truncate at invalid chars - if (strlen(section)) + for (char* j = section; *j; j++) + if ((*j < 33) || (*j > 126)) + *j = '\0'; // truncate at invalid chars + if (*section) { strlcpy(u->ident,section,IDENTMAX); Srv->Log(DEBUG,"IDENT SET: "+std::string(u->ident)); |