diff options
author | Stefan Fritsch <sf@apache.org> | 2010-06-04 01:00:53 +0200 |
---|---|---|
committer | Stefan Fritsch <sf@apache.org> | 2010-06-04 01:00:53 +0200 |
commit | 5d4b85bc360ab43d17473733124cce2e732a4a49 (patch) | |
tree | 3ebefb3c550a8adfd13f91df332eef3017d8fb86 /server/core.c | |
parent | Introduce SSLLOG_MARK for use with ssl_log_ssl_error(). This will allow to (diff) | |
download | apache2-5d4b85bc360ab43d17473733124cce2e732a4a49.tar.xz apache2-5d4b85bc360ab43d17473733124cce2e732a4a49.zip |
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
Diffstat (limited to '')
-rw-r--r-- | server/core.c | 52 |
1 files changed, 30 insertions, 22 deletions
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; |