felipe                                   Mon, 15 Nov 2010 17:06:27 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=305376

Log:
- Moved leak_variable() to zend_builtin_functions.c (Gustavo)

Changed paths:
    U   php/php-src/trunk/Zend/zend_builtin_functions.c
    U   php/php-src/trunk/ext/standard/basic_functions.c
    U   php/php-src/trunk/ext/standard/basic_functions.h

Modified: php/php-src/trunk/Zend/zend_builtin_functions.c
===================================================================
--- php/php-src/trunk/Zend/zend_builtin_functions.c     2010-11-15 17:06:07 UTC 
(rev 305375)
+++ php/php-src/trunk/Zend/zend_builtin_functions.c     2010-11-15 17:06:27 UTC 
(rev 305376)
@@ -54,6 +54,7 @@
 static ZEND_FUNCTION(class_alias);
 #if ZEND_DEBUG
 static ZEND_FUNCTION(leak);
+static ZEND_FUNCTION(leak_variable);
 #ifdef ZEND_TEST_EXCEPTIONS
 static ZEND_FUNCTION(crash);
 #endif
@@ -180,6 +181,13 @@
        ZEND_ARG_INFO(0, autoload)
 ZEND_END_ARG_INFO()

+#if ZEND_DEBUG
+ZEND_BEGIN_ARG_INFO_EX(arginfo_leak_variable, 0, 0, 1)
+       ZEND_ARG_INFO(0, variable)
+       ZEND_ARG_INFO(0, leak_data)
+ZEND_END_ARG_INFO()
+#endif
+
 ZEND_BEGIN_ARG_INFO_EX(arginfo_trigger_error, 0, 0, 1)
        ZEND_ARG_INFO(0, message)
        ZEND_ARG_INFO(0, error_type)
@@ -245,6 +253,7 @@
        ZEND_FE(class_alias,            arginfo_class_alias)
 #if ZEND_DEBUG
        ZEND_FE(leak,                           NULL)
+       ZEND_FE(leak_variable,          arginfo_leak_variable)
 #ifdef ZEND_TEST_EXCEPTIONS
        ZEND_FE(crash,                          NULL)
 #endif
@@ -1367,7 +1376,29 @@
 }
 /* }}} */

+/* {{{ proto leak_variable(mixed variable [, bool leak_data]) */
+ZEND_FUNCTION(leak_variable)
+{
+       zval *zv;
+       zend_bool leak_data = 0;

+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|b", &zv, 
&leak_data) == FAILURE) {
+               return;
+       }
+
+       if (!leak_data) {
+               zval_add_ref(&zv);
+       } else if (Z_TYPE_P(zv) == IS_RESOURCE) {
+               zend_list_addref(Z_RESVAL_P(zv));
+       } else if (Z_TYPE_P(zv) == IS_OBJECT) {
+               Z_OBJ_HANDLER_P(zv, add_ref)(zv TSRMLS_CC);
+       } else {
+               zend_error(E_WARNING, "Leaking non-zval data is only applicable 
to resources and objects");
+       }
+}
+/* }}} */
+
+
 #ifdef ZEND_TEST_EXCEPTIONS
 ZEND_FUNCTION(crash)
 {

Modified: php/php-src/trunk/ext/standard/basic_functions.c
===================================================================
--- php/php-src/trunk/ext/standard/basic_functions.c    2010-11-15 17:06:07 UTC 
(rev 305375)
+++ php/php-src/trunk/ext/standard/basic_functions.c    2010-11-15 17:06:27 UTC 
(rev 305376)
@@ -853,11 +853,6 @@
 #if ZEND_DEBUG
 ZEND_BEGIN_ARG_INFO(arginfo_config_get_hash, 0)
 ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_leak_variable, 0, 0, 1)
-       ZEND_ARG_INFO(0, variable)
-       ZEND_ARG_INFO(0, leak_data)
-ZEND_END_ARG_INFO()
 #endif

 #ifdef HAVE_GETLOADAVG
@@ -3002,7 +2997,6 @@
        PHP_FE(parse_ini_string,                                                
                                                arginfo_parse_ini_string)
 #if ZEND_DEBUG
        PHP_FE(config_get_hash,                                                 
                                                arginfo_config_get_hash)
-       PHP_FE(leak_variable,                                                   
                                                arginfo_leak_variable)
 #endif
        PHP_FE(is_uploaded_file,                                                
                                                arginfo_is_uploaded_file)
        PHP_FE(move_uploaded_file,                                              
                                                arginfo_move_uploaded_file)
@@ -5923,32 +5917,6 @@
        zend_hash_apply_with_arguments(hash TSRMLS_CC, (apply_func_args_t) 
add_config_entry_cb, 1, return_value);
 }
 /* }}} */
-
-/* {{{ proto leak_variable(variable [, leak_data]) */
-PHP_FUNCTION(leak_variable)
-{
-       zval *zv;
-       zend_bool leak_data = 0;
-
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|b", &zv, 
&leak_data) == FAILURE) {
-               return;
-       }
-
-       if (leak_data && (Z_TYPE_P(zv) != IS_RESOURCE && Z_TYPE_P(zv) != 
IS_OBJECT)) {
-               php_error_docref0(NULL TSRMLS_CC, E_WARNING,
-                       "Leaking non-zval data is only applicable to resources 
and objects");
-               return;
-       }
-
-       if (!leak_data) {
-               zval_add_ref(&zv);
-       } else if (Z_TYPE_P(zv) == IS_RESOURCE) {
-               zend_list_addref(Z_RESVAL_P(zv));
-       } else if (Z_TYPE_P(zv) == IS_OBJECT) {
-               Z_OBJ_HANDLER_P(zv, add_ref)(zv TSRMLS_CC);
-       }
-}
-/* }}} */
 #endif

 #ifdef HAVE_GETLOADAVG

Modified: php/php-src/trunk/ext/standard/basic_functions.h
===================================================================
--- php/php-src/trunk/ext/standard/basic_functions.h    2010-11-15 17:06:07 UTC 
(rev 305375)
+++ php/php-src/trunk/ext/standard/basic_functions.h    2010-11-15 17:06:27 UTC 
(rev 305376)
@@ -127,7 +127,6 @@
 PHP_FUNCTION(parse_ini_string);
 #if ZEND_DEBUG
 PHP_FUNCTION(config_get_hash);
-PHP_FUNCTION(leak_variable);
 #endif

 PHP_FUNCTION(str_rot13);

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to