Commit 3d74d6f8 authored by Greg Stein's avatar Greg Stein
Browse files

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
parent 14ed204f
Loading
Loading
Loading
Loading
+8 −12
Original line number Diff line number Diff line
@@ -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);

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

    if (p == NULL)
        return -1;
    return p - s;
}

AP_DECLARE(void) ap_str_tolower(char *str)