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
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)