diff options
author | Stefan Eissing <icing@apache.org> | 2015-09-03 11:39:59 +0200 |
---|---|---|
committer | Stefan Eissing <icing@apache.org> | 2015-09-03 11:39:59 +0200 |
commit | d84e8bfef678f612cef263bfdf4666c2983cecb4 (patch) | |
tree | d3832c6d59c55f3751d732a44d3e10278dfb66fe /server/util.c | |
parent | missed in r1698023 (diff) | |
download | apache2-d84e8bfef678f612cef263bfdf4666c2983cecb4.tar.xz apache2-d84e8bfef678f612cef263bfdf4666c2983cecb4.zip |
final final change to the new ap_array_str_* functions after review
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1700968 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'server/util.c')
-rw-r--r-- | server/util.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/server/util.c b/server/util.c index 21a7651235..cd7997295d 100644 --- a/server/util.c +++ b/server/util.c @@ -3149,23 +3149,27 @@ AP_DECLARE(char *) ap_get_exec_line(apr_pool_t *p, return apr_pstrndup(p, buf, k); } -AP_DECLARE(int) ap_array_index(const apr_array_header_t *array, - const char *s, - apr_size_t start) -{ - apr_size_t i; - for (i = start; i < array->nelts; i++) { - const char *p = APR_ARRAY_IDX(array, i, const char *); - if (!strcmp(p, s)) { - return (int)i; +AP_DECLARE(int) ap_array_str_index(const apr_array_header_t *array, + const char *s, + int start) +{ + if (start >= 0) { + int i; + + for (i = start; i < array->nelts; i++) { + const char *p = APR_ARRAY_IDX(array, i, const char *); + if (!strcmp(p, s)) { + return i; + } } } + return -1; } -AP_DECLARE(int) ap_array_contains(const apr_array_header_t *array, - const char *s) +AP_DECLARE(int) ap_array_str_contains(const apr_array_header_t *array, + const char *s) { - return (ap_array_index(array, s, 0) >= 0); + return (ap_array_str_index(array, s, 0) >= 0); } |