]> granicus.if.org Git - apache/commitdiff
Use 'ap_array_str_contains' to simplify code.
authorChristophe Jaillet <jailletc36@apache.org>
Fri, 11 Dec 2015 04:40:20 +0000 (04:40 +0000)
committerChristophe Jaillet <jailletc36@apache.org>
Fri, 11 Dec 2015 04:40:20 +0000 (04:40 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1719255 13f79535-47bb-0310-9956-ffa450edef68

server/util_expr_eval.c

index 08ba66a4102e2a47bf748818c29ff4adff26605d..ee38ddf2cf5e669576ed168e47c2170cee2649cd 100644 (file)
@@ -294,15 +294,15 @@ static int ap_expr_eval_comp(ap_expr_eval_ctx_t *ctx, const ap_expr_t *node)
                 const ap_expr_t *arg = e2->node_arg2;
                 ap_expr_list_func_t *func = (ap_expr_list_func_t *)info->node_arg1;
                 apr_array_header_t *haystack;
-                int i = 0;
+
                 AP_DEBUG_ASSERT(func != NULL);
                 AP_DEBUG_ASSERT(info->node_op == op_ListFuncInfo);
                 haystack = (*func)(ctx, info->node_arg2, ap_expr_eval_word(ctx, arg));
-                if (haystack == NULL)
+                if (haystack == NULL) {
                     return 0;
-                for (; i < haystack->nelts; i++) {
-                    if (strcmp(needle, APR_ARRAY_IDX(haystack,i,char *)) == 0)
-                        return 1;
+                }
+                if (ap_array_str_contains(haystack, needle)) {
+                    return 1;
                 }
             }
             return 0;