]> granicus.if.org Git - php/commitdiff
leftovers
authorSterling Hughes <sterling@php.net>
Sun, 27 May 2001 00:58:08 +0000 (00:58 +0000)
committerSterling Hughes <sterling@php.net>
Sun, 27 May 2001 00:58:08 +0000 (00:58 +0000)
ext/xslt/php_sablot.h
ext/xslt/xslt.c

index 0f0235248ba9c78f2843dd0d59646d52bb52813d..5f6061ed1192246c936c449710b407ad04310240 100644 (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 {
index 2f59e72eb56f55cb229acf412b366faa8d355c8d..265eaa0c04661c917fc9d72067079c1bcf500198 100644 (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]);
        }
-}
-/* }}} */
 
-
-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