From: Sterling Hughes Date: Sun, 27 May 2001 00:58:08 +0000 (+0000) Subject: leftovers X-Git-Tag: PRE_GRANULAR_GARBAGE_FIX~237 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=129f37093a2ed80d45b3e1ee803f441b7450ff51;p=php leftovers --- diff --git a/ext/xslt/php_sablot.h b/ext/xslt/php_sablot.h index 0f0235248b..5f6061ed11 100644 --- a/ext/xslt/php_sablot.h +++ b/ext/xslt/php_sablot.h @@ -62,29 +62,29 @@ PHP_FUNCTION(xslt_errno); PHP_FUNCTION(xslt_free); struct scheme_handlers { - struct xslt_function *get_all; - struct xslt_function *open; - struct xslt_function *get; - struct xslt_function *put; - struct xslt_function *close; + zval *get_all; + zval *open; + zval *get; + zval *put; + zval *close; }; struct sax_handlers { - struct xslt_function *doc_start; - struct xslt_function *element_start; - struct xslt_function *element_end; - struct xslt_function *namespace_start; - struct xslt_function *namespace_end; - struct xslt_function *comment; - struct xslt_function *pi; - struct xslt_function *characters; - struct xslt_function *doc_end; + zval *doc_start; + zval *element_start; + zval *element_end; + zval *namespace_start; + zval *namespace_end; + zval *comment; + zval *pi; + zval *characters; + zval *doc_end; }; struct xslt_handlers { struct scheme_handlers scheme; struct sax_handlers sax; - struct xslt_function *error; + zval *error; }; struct xslt_processor { diff --git a/ext/xslt/xslt.c b/ext/xslt/xslt.c index 2f59e72eb5..265eaa0c04 100644 --- a/ext/xslt/xslt.c +++ b/ext/xslt/xslt.c @@ -21,7 +21,9 @@ #if HAVE_XSLT +#include #include +#include static int debug = 0; @@ -202,26 +204,31 @@ extern void xslt_free_arguments(xslt_args *to_free) /* {{{ call_xslt_function() Call an XSLT handler */ extern void xslt_call_function(char *name, - struct xslt_function *fptr, + zval *function, int argc, - zval **argv, + zval **user_args, zval **retval) { - int error; /* Error container */ - int idx; /* Idx, when looping through and free'ing the arguments */ - ELS_FETCH(); /* For TS mode, fetch the executor globals */ + zval ***argv; /* Argument container, maps around for call_user_function_ex() */ + int error; /* Error container */ + int idx; /* Idx, when looping through and free'ing the arguments */ + ELS_FETCH(); /* For TS mode, fetch the executor globals */ /* Allocate and initialize return value from the function */ MAKE_STD_ZVAL(*retval); + argv = emalloc(argc * sizeof(zval **)); + for (idx = 0; idx < argc; idx++) { + argv[idx] = &user_args[idx]; + } + /* Call the function */ - error = call_user_function(EG(function_table), - XSLT_OBJ(fptr), - XSLT_FUNC(fptr), - *retval, argc, argv); + error = call_user_function_ex(EG(function_table), + NULL, function, + *retval, argc, argv, O, NULL); if (error == FAILURE) { php_error(E_WARNING, "Cannot call the %s handler: %s", - name, Z_STRVAL_P(XSLT_FUNC(fptr))); + name, Z_STRVAL_P(function)); } /* Cleanup arguments */ @@ -229,65 +236,8 @@ extern void xslt_call_function(char *name, /* Decrease refcount and free if refcount is <= 0 */ zval_ptr_dtor(&argv[idx]); } -} -/* }}} */ - -extern void xslt_free_handler(struct xslt_function *func) -{ - if (!func) { - return; - } - - if (func->obj) { - efree(func->obj); - } - - if (func->func) { - efree(func->func); - } - - efree(func); + efree(argv); } - -extern void xslt_assign_handler(struct xslt_function **func, zval **zfunc) -{ - char error[] = "Invalid function passed to %s"; - - *func = emalloc(sizeof(struct xslt_function)); - - if (Z_TYPE_PP(zfunc) == IS_STRING) { - (*func)->obj = NULL; - - zval_add_ref(zfunc); - (*func)->func = *zfunc; - } - else if (Z_TYPE_PP(zfunc) == IS_ARRAY) { - zval **obj; - zval **function; - - if (zend_hash_index_find(Z_ARRVAL_PP(zfunc), 0, (void **) &obj) == FAILURE) { - efree(*func); - php_error(E_WARNING, error, get_active_function_name()); - return; - } - - if (zend_hash_index_find(Z_ARRVAL_PP(zfunc), 1, (void **) &function) == FAILURE) { - efree(*func); - php_error(E_WARNING, error, get_active_function_name()); - return; - } - - zval_add_ref(obj); - zval_add_ref(function); - - (*func)->obj = *obj; - (*func)->func = *function; - } - else { - efree(*func); - php_error(E_WARNING, error, get_active_function_name()); - } -} - +/* }}} */ #endif