From: om Date: Mon, 3 Apr 2006 17:25:14 +0000 (+0000) Subject: Remove un-needed strlen and pointer in duration() X-Git-Tag: v2.0.23~8312 X-Git-Url: https://git.netwichtig.de/gitweb/?a=commitdiff_plain;h=bc461262685ac30a9f4629224a2d09a53190167d;p=user%2Fhenk%2Fcode%2Finspircd.git Remove un-needed strlen and pointer in duration() git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3805 e03df62e-2008-0410-955e-edbf42e46eb7 --- diff --git a/src/commands.cpp b/src/commands.cpp index 1715a9ace..da4deff65 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -216,17 +216,16 @@ long duration(const char* str) { char n_field[MAXBUF]; long total = 0; - const char* str_end = str + strlen(str); n_field[0] = 0; if ((!strchr(str,'s')) && (!strchr(str,'m')) && (!strchr(str,'h')) && (!strchr(str,'d')) && (!strchr(str,'w')) && (!strchr(str,'y'))) { std::string n = str; - n = n + "s"; + n += 's'; return duration(n.c_str()); } - for (char* i = (char*)str; i < str_end; i++) + for (char* i = (char*)str; *i; i++) { // if we have digits, build up a string for the value in n_field, // up to 10 digits in size.