mike Wed, 03 Nov 2010 08:35:16 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=305051
Log:
explicitness FTW; it should have been like that before, so it wouldn't have
happened
Changed paths:
U php/php-src/trunk/main/output.c
Modified: php/php-src/trunk/main/output.c
===================================================================
--- php/php-src/trunk/main/output.c 2010-11-03 05:10:28 UTC (rev 305050)
+++ php/php-src/trunk/main/output.c 2010-11-03 08:35:16 UTC (rev 305051)
@@ -570,7 +570,7 @@
if (SUCCESS != zend_hash_next_index_insert(&rev, &check_func,
sizeof(php_output_handler_conflict_check_t *), NULL)) {
zend_hash_destroy(&rev);
return FAILURE;
- }
+ }
if (SUCCESS !=
zend_hash_update(&php_output_handler_reverse_conflicts, name, name_len+1, &rev,
sizeof(HashTable), NULL)) {
zend_hash_destroy(&rev);
return FAILURE;
@@ -730,6 +730,20 @@
}
/* }}} */
+/* {{{ static void php_output_context_feed(php_output_context *context, char
*, size_t, size_t)
+ Feed output contexts input buffer */
+static inline void php_output_context_feed(php_output_context *context, char
*data, size_t size, size_t used, zend_bool free)
+{
+ if (context->in.free && context->in.data) {
+ efree(context->in.data);
+ }
+ context->in.data = data;
+ context->in.used = used;
+ context->in.free = free;
+ context->in.size = size;
+}
+/* }}} */
+
/* {{{ static void php_output_context_swap(php_output_context *context)
Swap output contexts buffers */
static inline void php_output_context_swap(php_output_context *context)
@@ -743,6 +757,7 @@
context->in.size = context->out.size;
context->out.data = NULL;
context->out.used = 0;
+ context->out.free = 0;
context->out.size = 0;
}
/* }}} */
@@ -757,6 +772,7 @@
context->out.free = context->in.free;
context->in.data = NULL;
context->in.used = 0;
+ context->in.free = 0;
context->in.size = 0;
}
/* }}} */
@@ -902,12 +918,8 @@
}
} else {
- if (context->in.data && context->in.free) {
- efree(context->in.data);
- }
- context->in.data = handler->buffer.data;
- context->in.used = handler->buffer.used;
- context->in.free = 0;
+
+ php_output_context_feed(context, handler->buffer.data,
handler->buffer.size, handler->buffer.used, 0);
if (SUCCESS == handler->func.internal(&handler->opaq,
context)) {
if (context->out.used) {
@@ -1077,7 +1089,7 @@
return 0;
}
/* }}} */
-
+
/* {{{ static int php_output_stack_apply_list(void *h, void *z)
List callback for the stack apply function */
static int php_output_stack_apply_list(void *h, void *z)
@@ -1202,12 +1214,7 @@
Default output handler */
static int php_output_handler_default_func(void **handler_context,
php_output_context *output_context)
{
- output_context->out.data = output_context->in.data;
- output_context->out.used = output_context->in.used;
- output_context->out.free = output_context->in.free;
- output_context->in.data = NULL;
- output_context->in.used = 0;
- output_context->in.free = 0;
+ php_output_context_pass(output_context);
return SUCCESS;
}
/* }}} */
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php