]> granicus.if.org Git - apache/commitdiff
Move logic to find module by name into new function find_module().
authorStefan Fritsch <sf@apache.org>
Thu, 3 Jun 2010 23:00:53 +0000 (23:00 +0000)
committerStefan Fritsch <sf@apache.org>
Thu, 3 Jun 2010 23:00:53 +0000 (23:00 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@951195 13f79535-47bb-0310-9956-ffa450edef68

server/core.c

index 6045951fb2392e4066d24b58038b25a281662301..63e4b1cb62baa9b7b22df34585f029ccaad0d33f 100644 (file)
@@ -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;