]> git.sesse.net Git - xml-template/commitdiff
Leak a little less memory in php5-swig.
authorsgunderson@bigfoot.com <>
Thu, 22 Sep 2011 21:22:09 +0000 (23:22 +0200)
committersgunderson@bigfoot.com <>
Thu, 22 Sep 2011 21:22:09 +0000 (23:22 +0200)
12 files changed:
php5-swig/attribute-empty.php
php5-swig/attribute.php
php5-swig/attribute2.php
php5-swig/attribute3.php
php5-swig/clone.php
php5-swig/include.php
php5-swig/namespace.php
php5-swig/namespace2.php
php5-swig/passthru.php
php5-swig/simple.php
php5-swig/structure.php
php5-swig/xml-template.swig

index 5a33f6362aff68fd03abda1b288d9b04c60e9d2d..3886e7d5316cfdcdc4421574f333b9a8fed62685 100644 (file)
@@ -5,7 +5,7 @@ dl("XML_Template_SWIG.so");
 # NULL values are ignored, but having one helps pointing out that
 # the array given is non-associative
 
-$doc = process_file('../xml/clone.xml', array(
+$doc = XML_Template_process_file('../xml/clone.xml', array(
        'color' => 'blue',
        '#things' => array(NULL)
 ), true);
index fa5a0dfe08a1bc44f7855b8c58cc0db978bf7d35..d63cf69c23ab1ac0c5ec4fe059cf272314f0e774 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 
 dl("XML_Template_SWIG.so");
-$doc = process_file('../xml/clone.xml', array(
+$doc = XML_Template_process_file('../xml/clone.xml', array(
        'color' => 'red',
        '#things' => array(
                array( 'li' => 'Raindrops on roses',    'li/class' => 'odd' ),
index adcad317c0aa324a442c58dac432da03c68268c6..4b33237e2a9bd96740c79def77ec5f11b5837961 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 
 dl("XML_Template_SWIG.so");
-$doc = process_file('../xml/clone.xml', array(
+$doc = XML_Template_process_file('../xml/clone.xml', array(
        'color' => 'blue',
        '#things' => XML_Template_alternate('li/class', array(
                array( 'li' => 'Raindrops on roses' ),
index 8b84e7da6b520b5948640c1f78af4b7040579ec5..f3afc60f13cf6471da9d9bc97230aee4c3a10e91 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 
 dl("XML_Template_SWIG.so");
-$doc = process_file('../xml/clone.xml', array(
+$doc = XML_Template_process_file('../xml/clone.xml', array(
        'color' => 'blue',
        '#things' => XML_Template_alternate('li/class', array(
                array( 'li' => 'Raindrops on roses' ),
index abe0e307c3ec6d62317843cdf41117f5246c29c7..a0f98a7de1dce8f8832445fdf80b93e5f36af5d6 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 
 dl("XML_Template_SWIG.so");
-$doc = process_file('../xml/clone.xml', array( 
+$doc = XML_Template_process_file('../xml/clone.xml', array( 
        'color' => 'blue',
        '#things' => array(
                array( 'li' => 'Raindrops on roses' ),
index 5e3ff4e88de30287dc2d16ebeca3162bb84dff7d..a648bb5a6f1b56417802b93bcbe2536dd4cddbcd 100644 (file)
@@ -1,10 +1,10 @@
 <?php
 
 dl("XML_Template_SWIG.so");
-$doc = process_file('../xml/included.xml', array(
+$doc = XML_Template_process_file('../xml/included.xml', array(
        'color' => 'red'
 ), 0);
-$master = process_file('../xml/master.xml', array(
+$master = XML_Template_process_file('../xml/master.xml', array(
        'title' => 'Main HTML title',
        'h1' => 'Nice heading here',
        'contents' => $doc
index 1dfc9b935421a29e2e64f4dff2589df35f7f391a..f17fb7460926488b5a71c4201945e9b0bd92608a 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 
 dl("XML_Template_SWIG.so");
-$doc = process_file('../xml/namespace.xml', array( 
+$doc = XML_Template_process_file('../xml/namespace.xml', array( 
        'title' => 'Namespace tests',
        '#hello' => 'Hello world!',
        '#test' => 'Replaced.',
index a4c4426eac7deb1f53d5b246b4bf16083645fda4..06c7bd628137b61507634729710df6c17d33d971 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 
 dl("XML_Template_SWIG.so");
-$doc = process_file('../xml/namespace2.xml', array( 
+$doc = XML_Template_process_file('../xml/namespace2.xml', array( 
        'title' => 'Namespace tests',
        '#hello' => 'Replaced.',
 ), true);
index 8102a3807f1391719941f05f202c516e214013ad..3b3822b196b88649348618120c362b5f79740475 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 
 dl("XML_Template_SWIG.so");
-$doc = process_file('../xml/passthru.xml', array(), true);
+$doc = XML_Template_process_file('../xml/passthru.xml', array(), true);
 output_to_fd_and_free($doc, 1);
 
 ?>
index 44cbd2f775ffefe04df5d2569c6c5e3e885dd930..2f29d51d52863ead46eb99c73461dc7f973c32dd 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 
 dl("XML_Template_SWIG.so");
-$doc = process_file('../xml/simple.xml', array( 
+$doc = XML_Template_process_file('../xml/simple.xml', array( 
        'title' => 'A very basic example',
        '#hello' => 'Hello world!'
 ), true);
index c3a684e4d67e9cf1f092c313b5762caa0620a6cd..2bc8c442dfb9441edb57c0922dbd00c7d1d62e8a 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 
 dl("XML_Template_SWIG.so");
-$doc = process_file('../xml/structure.xml', array(
+$doc = XML_Template_process_file('../xml/structure.xml', array(
        '#outer' => array(
                array( '#inner' => 'One' ),
                array( '#inner' => 'Two' ),
index 8a915ff4b8a7922459c813aaf2ff59fffb92982c..2feceba72843fada4f12226cfd7acf6ff36361cf 100644 (file)
@@ -68,12 +68,19 @@ Directive* convert_php_objects_to_directive(zval *obj)
        return NULL;
 }
 
+xmlDocPtr XML_Template_process_file(const char *input_filename, Directive *root_directive, bool clean)
+{
+       xmlDocPtr ret = process_file(input_filename, root_directive, clean);
+       delete root_directive;
+       return ret;
+}
+
 %}
 
 %typemap(in) Directive* {
        $1 = convert_php_objects_to_directive(*$input);
 }
 
-xmlDocPtr process_file(const char *input_filename, Directive *root_directive, bool clean);
+xmlDocPtr XML_Template_process_file(const char *input_filename, Directive *root_directive, bool clean);
 void output_to_fd_and_free(xmlDocPtr doc, int fd);