From: Stefan Fritsch Date: Thu, 3 Jun 2010 23:00:53 +0000 (+0000) Subject: Move logic to find module by name into new function find_module(). X-Git-Tag: 2.3.6~62 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5d4b85bc360ab43d17473733124cce2e732a4a49;p=apache Move logic to find module by name into new function find_module(). git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@951195 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/server/core.c b/server/core.c index 6045951fb2..63e4b1cb62 100644 --- a/server/core.c +++ b/server/core.c @@ -2090,34 +2090,16 @@ static const char *ifsection(cmd_parms *cmd, void *mconfig, const char *arg) return NULL; } -static const char *start_ifmod(cmd_parms *cmd, void *mconfig, const char *arg) +static module *find_module(server_rec *s, const char *name) { - const char *endp = ap_strrchr_c(arg, '>'); - int not = (arg[0] == '!'); - module *found; - - if (endp == NULL) { - return unclosed_directive(cmd); - } - - arg = apr_pstrndup(cmd->pool, arg, endp - arg); - - if (not) { - arg++; - } - - if (!arg[0]) { - return missing_container_arg(cmd); - } - - found = ap_find_linked_module(arg); + module *found = ap_find_linked_module(name); /* search prelinked stuff */ if (!found) { ap_module_symbol_t *current = ap_prelinked_module_symbols; for (; current->name; ++current) { - if (!strcmp(current->name, arg)) { + if (!strcmp(current->name, name)) { found = current->modp; break; } @@ -2130,10 +2112,36 @@ static const char *start_ifmod(cmd_parms *cmd, void *mconfig, const char *arg) APR_RETRIEVE_OPTIONAL_FN(ap_find_loaded_module_symbol); if (check_symbol) { - found = check_symbol(cmd->server, arg); + found = check_symbol(s, name); } } + return found; +} + + +static const char *start_ifmod(cmd_parms *cmd, void *mconfig, const char *arg) +{ + const char *endp = ap_strrchr_c(arg, '>'); + int not = (arg[0] == '!'); + module *found; + + if (endp == NULL) { + return unclosed_directive(cmd); + } + + arg = apr_pstrndup(cmd->pool, arg, endp - arg); + + if (not) { + arg++; + } + + if (!arg[0]) { + return missing_container_arg(cmd); + } + + found = find_module(cmd->server, arg); + if ((!not && found) || (not && !found)) { ap_directive_t *parent = NULL; ap_directive_t *current = NULL;