1
0
mirror of https://github.com/php/php-src.git synced 2026-04-12 10:33:11 +02:00

leftovers

This commit is contained in:
Sterling Hughes
2001-05-27 00:58:08 +00:00
parent a2962a1312
commit 129f37093a
2 changed files with 34 additions and 84 deletions

View File

@@ -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 {

View File

@@ -21,7 +21,9 @@
#if HAVE_XSLT
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
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]);
}
efree(argv);
}
/* }}} */
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);
}
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