]> granicus.if.org Git - php/commitdiff
If the user wants to use more than one handle reuse the old handle.
authorSterling Hughes <sterling@php.net>
Sun, 3 Sep 2000 19:58:12 +0000 (19:58 +0000)
committerSterling Hughes <sterling@php.net>
Sun, 3 Sep 2000 19:58:12 +0000 (19:58 +0000)
ext/sablot/php_sablot.h
ext/sablot/sablot.c

index 1baca7bfa2f50f2649ab6cc77005593e2796d1ab..f0ec2d4735147c901ed042c2e5bd732b0a8d36b1 100644 (file)
@@ -80,6 +80,7 @@ typedef struct {
        char *output_transform_file;
        int le_sablot;
        int last_errno;
+       int current_processor;
 } php_sablot_globals;
 
 
index 0bde0bf6db3ac5d6b4e64fdabe97318d13a2cf38..09848a13f9bc2d9bffaf9d9dab764aedcbabb0b5 100644 (file)
@@ -370,6 +370,12 @@ PHP_FUNCTION(xslt_create)
        int ret;
        SABLOTLS_FETCH();
 
+       if (SABLOTG(current_processor)) {
+               Z_TYPE_P(return_value) = IS_RESOURCE;
+               Z_LVAL_P(return_value) = SABLOTG(current_processor);
+               return;
+       }
+       
        ret = SablotCreateProcessor(&p);
        
        if (ret) {
@@ -403,6 +409,7 @@ PHP_FUNCTION(xslt_create)
        
        ZEND_REGISTER_RESOURCE(return_value, handle, SABLOTG(le_sablot));
        handle->index = Z_LVAL_P(return_value);
+       SABLOTG(current_processor) = Z_LVAL_P(return_value);
 }
 /* }}} */
 
@@ -1079,6 +1086,8 @@ static void _php_sablot_free_processor(php_sablot *handle)
                SablotUnregHandler(handle->p, HLR_SAX, NULL, NULL);
                SablotDestroyProcessor(handle->p);
        }
+       SABLOTG(current_processor) = 0;
+       
        FUNCH_FREE(handle->startDocHandler);
        FUNCH_FREE(handle->startElementHandler);
        FUNCH_FREE(handle->endElementHandler);