From: Greg Stein Date: Mon, 12 Feb 2001 02:39:24 +0000 (+0000) Subject: write these in terms of strchr and strrchr so the compiler can possibly use X-Git-Tag: 2.0.11~40 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=de083a7ba1505713106ee3e0fb21051e613e2fe1;p=apache write these in terms of strchr and strrchr so the compiler can possibly use builtin, optimized functions. [ they're stupid functions, but what the hell ] git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@88101 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/server/util.c b/server/util.c index 29d61dbe53..a8d4ff2adb 100644 --- a/server/util.c +++ b/server/util.c @@ -1720,24 +1720,20 @@ AP_DECLARE(int) ap_is_url(const char *u) AP_DECLARE(int) ap_ind(const char *s, char c) { - register int x; - - for (x = 0; s[x]; x++) - if (s[x] == c) - return x; + const char *p = ap_strchr_c(s, c); - return -1; + if (p == NULL) + return -1; + return p - s; } AP_DECLARE(int) ap_rind(const char *s, char c) { - register int x; - - for (x = strlen(s) - 1; x != -1; x--) - if (s[x] == c) - return x; + const char *p = ap_strrchr_c(s, c); - return -1; + if (p == NULL) + return -1; + return p - s; } AP_DECLARE(void) ap_str_tolower(char *str)