[svn:mod_parrot] r621 - mod_parrot/trunk/src

[email protected] Sun, 1 Mar 2009 08:32:31 -0800 (PST)
Newsgroups perl.cvs.mod_parrot
Message-ID <[email protected]>
Author: jhorwitz
Date: Sun Mar  1 08:32:31 2009
New Revision: 621

Modified:
   mod_parrot/trunk/src/module.c

Log:
don't add apache modules twice


Modified: mod_parrot/trunk/src/module.c
==============================================================================
--- mod_parrot/trunk/src/module.c	(original)
+++ mod_parrot/trunk/src/module.c	Sun Mar  1 08:32:31 2009
@@ -442,12 +442,20 @@
     modparrot_module_info *minfo;
     Parrot_PMC sub;
     Parrot_PMC hpmc;
-    module *modp = (module *)apr_pcalloc(p, sizeof(*modp));
+    module *modp;
     modparrot_context *ctxp = get_interp_ctx(interp);
     server_rec *s = ctxp->s;
 
+    if (modp =
+        apr_hash_get(mp_globals.module_hash, name, APR_HASH_KEY_STRING)) {
+        MP_TRACE_m(s, "already added module '%s' - skipping", name);
+        return(modp);
+    }
+
     MP_TRACE_m(s, "adding module '%s'", name);
 
+    modp = (module *)apr_pcalloc(p, sizeof(*modp));
+
     /* custom directives are optional */
     command_rec *cmds = NULL;
     if (PMC_IS_NULL(cmd_array)) {