]> granicus.if.org Git - php/commitdiff
add optional flush paramter to xmlwriter_output_memory
authorRob Richards <rrichards@php.net>
Tue, 20 Jul 2004 15:13:53 +0000 (15:13 +0000)
committerRob Richards <rrichards@php.net>
Tue, 20 Jul 2004 15:13:53 +0000 (15:13 +0000)
ext/xmlwriter/php_xmlwriter.c

index 9dcba9c9419ed4aace10a33e5cb684f273ca6aaa..27eb44d8860adcf71c86fd59d71665616f6293e8 100644 (file)
@@ -1245,7 +1245,7 @@ PHP_FUNCTION(xmlwriter_open_memory)
 
 }
 
-/* {{{ proto string xmlwriter_output_memory(resource xmlwriter)
+/* {{{ proto string xmlwriter_output_memory(resource xmlwriter [,bool flush])
 Output current buffer as string */
 PHP_FUNCTION(xmlwriter_output_memory)
 {
@@ -1253,8 +1253,9 @@ PHP_FUNCTION(xmlwriter_output_memory)
        xmlwriter_object *intern;
        xmlTextWriterPtr ptr;
        xmlBufferPtr buffer;
+       int flush = 1;
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &pind) == FAILURE) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|b", &pind, &flush) == FAILURE) {
                return;
        }
 
@@ -1265,7 +1266,9 @@ PHP_FUNCTION(xmlwriter_output_memory)
        if (ptr && buffer) {
                xmlTextWriterFlush(ptr);
                RETVAL_STRING(buffer->content, 1);
-               xmlBufferEmpty(buffer);
+               if (flush) {
+                       xmlBufferEmpty(buffer);
+               }
                return;
        }