pTHX;
static void *modperl_module_config_merge(apr_pool_t *p,                                         void *basev, void *addv,                                         int type){    GV *gv;    modperl_mgv_t *method;    modperl_module_cfg_t *mrg = NULL,        *tmp,        *base = (modperl_module_cfg_t *)basev,        *add  = (modperl_module_cfg_t *)addv;    server_rec *s;    int is_startup;    PTR_TBL_t *table;    SV *mrg_obj = Nullsv, *base_obj, *add_obj;#ifdef USE_ITHREADS    modperl_interp_t *interp;    pTHX;#endif    /* if the module is loaded in vhost, base==NULL */    tmp = (base && base->server) ? base : add;    if (tmp && !tmp->server) {        /* no directives for this module were encountered so far */        return basev;    }    s = tmp->server;    is_startup = (p == s->process->pconf);#ifdef USE_ITHREADS    interp = modperl_interp_pool_select(p, s);    aTHX = interp->perl;#endif    table = modperl_module_config_table_get(aTHX_ TRUE);    base_obj = modperl_svptr_table_fetch(aTHX_ table, base);    add_obj  = modperl_svptr_table_fetch(aTHX_ table, add);    if (!base_obj || (base_obj == add_obj)) {        return addv;    }    mrg = modperl_module_cfg_new(p);    memcpy(mrg, tmp, sizeof(*mrg));    method = (type == MP_CFG_MERGE_DIR) ?        mrg->minfo->dir_merge :        mrg->minfo->srv_merge;    if (method && (gv = modperl_mgv_lookup(aTHX_ method))) {        int count;        dSP;        MP_TRACE_c(MP_FUNC, "calling %s->%s\n",                   SvCLASS(base_obj), modperl_mgv_last_name(method));        ENTER;SAVETMPS;        PUSHMARK(sp);        XPUSHs(base_obj);XPUSHs(add_obj);        PUTBACK;        count = call_sv((SV*)GvCV(gv), G_EVAL|G_SCALAR);        SPAGAIN;        if (count == 1) {            mrg_obj = SvREFCNT_inc(POPs);        }        PUTBACK;        FREETMPS;LEAVE;        if (SvTRUE(ERRSV)) {            /* XXX: should die here. */            (void)modperl_errsv(aTHX_ HTTP_INTERNAL_SERVER_ERROR,                                NULL, NULL);        }    }    else {        mrg_obj = SvREFCNT_inc(add_obj);    }    modperl_svptr_table_store(aTHX_ table, mrg, mrg_obj);    if (!is_startup) {        modperl_module_config_obj_cleanup_register(aTHX_ p, table, mrg);    }    return (void *)mrg;}