From 7e96ac17cf36792649b1271eb1d3eaa15ce58927 Mon Sep 17 00:00:00 2001 From: Christophe Jaillet Date: Fri, 11 Dec 2015 04:40:20 +0000 Subject: [PATCH] Use 'ap_array_str_contains' to simplify code. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1719255 13f79535-47bb-0310-9956-ffa450edef68 --- server/util_expr_eval.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/server/util_expr_eval.c b/server/util_expr_eval.c index 08ba66a410..ee38ddf2cf 100644 --- a/server/util_expr_eval.c +++ b/server/util_expr_eval.c @@ -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; -- 2.50.0