diff options
author | Jim Jagielski <jim@apache.org> | 2016-01-19 12:56:57 +0000 |
---|---|---|
committer | Jim Jagielski <jim@apache.org> | 2016-01-19 12:56:57 +0000 |
commit | 91fbc87b8a7a8d1c1c645a271442dca27607db8c (patch) | |
tree | f3a3494385dba3a3221c9a3b0e6a3822ffdc4839 /server | |
parent | b505bc13acf78262b67cfd4fcff37013ae38d708 (diff) | |
download | httpd-91fbc87b8a7a8d1c1c645a271442dca27607db8c.tar.gz |
Merge r1719252, r1719254, r1719255, r1720996 from trunk:
Use 'ap_array_str_contains' to simplify code.
Use 'ap_array_str_contains' to simplify code.
Use 'ap_array_str_contains' to simplify code.
Use 'ap_array_str_contains' to simplify code.
Submitted by: jailletc36
Reviewed/backported by: jim
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1725507 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'server')
-rw-r--r-- | server/core.c | 12 | ||||
-rw-r--r-- | server/util_expr_eval.c | 10 |
2 files changed, 6 insertions, 16 deletions
diff --git a/server/core.c b/server/core.c index 7ed6d9cc1b..9ee2638f50 100644 --- a/server/core.c +++ b/server/core.c @@ -2603,17 +2603,7 @@ static const char *start_ifmod(cmd_parms *cmd, void *mconfig, const char *arg) AP_DECLARE(int) ap_exists_config_define(const char *name) { - char **defines; - int i; - - defines = (char **)ap_server_config_defines->elts; - for (i = 0; i < ap_server_config_defines->nelts; i++) { - if (strcmp(defines[i], name) == 0) { - return 1; - } - } - - return 0; + return ap_array_str_contains(ap_server_config_defines, name); } static const char *start_ifdefine(cmd_parms *cmd, void *dummy, const char *arg) diff --git a/server/util_expr_eval.c b/server/util_expr_eval.c index 1038e7aeed..d85706c23d 100644 --- a/server/util_expr_eval.c +++ b/server/util_expr_eval.c @@ -271,15 +271,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; |