You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by sf...@apache.org on 2010/06/04 01:00:53 UTC

svn commit: r951195 - /httpd/httpd/trunk/server/core.c

Author: sf
Date: Thu Jun  3 23:00:53 2010
New Revision: 951195

URL: http://svn.apache.org/viewvc?rev=951195&view=rev
Log:
Move logic to find module by name into new function find_module().

Modified:
    httpd/httpd/trunk/server/core.c

Modified: httpd/httpd/trunk/server/core.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/core.c?rev=951195&r1=951194&r2=951195&view=diff
==============================================================================
--- httpd/httpd/trunk/server/core.c (original)
+++ httpd/httpd/trunk/server/core.c Thu Jun  3 23:00:53 2010
@@ -2090,34 +2090,16 @@ static const char *ifsection(cmd_parms *
     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
             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;