perl.cvs.mod_parrot
[Top] [All Lists]

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

Subject: [svn:mod_parrot] r369 - mod_parrot/trunk/src
From: jhorwitz@xxxxxxxxxxxx
Date: Mon, 21 Jul 2008 11:55:34 -0700 (PDT)
Newsgroups: perl.cvs.mod_parrot

Author: jhorwitz
Date: Mon Jul 21 11:55:34 2008
New Revision: 369

Modified:
   mod_parrot/trunk/src/nci.c

Log:
return array of PMCNULLs if asking for a handler that doesn't exist


Modified: mod_parrot/trunk/src/nci.c
==============================================================================
--- mod_parrot/trunk/src/nci.c  (original)
+++ mod_parrot/trunk/src/nci.c  Mon Jul 21 11:55:34 2008
@@ -201,6 +201,10 @@
     if (!ctxp) return NULL;
 
     if (update) {
+        if (!ctxp->dircfg->handler) {
+            ctxp->dircfg->handler = (modparrot_handler_info *)apr_pcalloc(
+                ctxp->pconf, sizeof(modparrot_handler_info));
+        }
         ctxp->dircfg->handler->hll = apr_pstrdup(ctxp->pconf, hll);
         ctxp->dircfg->handler->id = apr_pstrdup(ctxp->pconf, id);
     }
@@ -210,10 +214,17 @@
     /* XXX how do we unregister this after it's used? */
     Parrot_register_pmc(interp, handler);
     Parrot_PMC_set_intval(interp, handler, 2);
-    Parrot_PMC_set_cstring_intkey(interp, handler, 0,
-        ctxp->dircfg->handler->hll);
-    Parrot_PMC_set_cstring_intkey(interp, handler, 1,
-        ctxp->dircfg->handler->id);
+
+    if (ctxp->dircfg->handler) {
+        Parrot_PMC_set_cstring_intkey(interp, handler, 0,
+            ctxp->dircfg->handler ? ctxp->dircfg->handler->hll : "");
+        Parrot_PMC_set_cstring_intkey(interp, handler, 1,
+            ctxp->dircfg->handler ? ctxp->dircfg->handler->id : "");
+    }
+    else {
+        Parrot_PMC_set_pmc_intkey(interp, handler, 0, PMCNULL);
+        Parrot_PMC_set_pmc_intkey(interp, handler, 1, PMCNULL);
+    }
 
     return(handler);
 }

<Prev in Thread] Current Thread [Next in Thread>
  • [svn:mod_parrot] r369 - mod_parrot/trunk/src, jhorwitz <=