andrei          Thu Oct 19 20:55:08 2006 UTC

  Modified files:              
    /php-src/ext/standard       head.c info.c 
  Log:
  Pick some low-hanging fruit.
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/head.c?r1=1.91&r2=1.92&diff_format=u
Index: php-src/ext/standard/head.c
diff -u php-src/ext/standard/head.c:1.91 php-src/ext/standard/head.c:1.92
--- php-src/ext/standard/head.c:1.91    Thu Oct 19 17:55:33 2006
+++ php-src/ext/standard/head.c Thu Oct 19 20:55:08 2006
@@ -15,7 +15,7 @@
    | Author: Rasmus Lerdorf <[EMAIL PROTECTED]>                        |
    +----------------------------------------------------------------------+
  */
-/* $Id: head.c,v 1.91 2006/10/19 17:55:33 andrei Exp $ */
+/* $Id: head.c,v 1.92 2006/10/19 20:55:08 andrei Exp $ */
 
 #include <stdio.h>
 #include "php.h"
@@ -247,11 +247,11 @@
        sapi_header_struct *sapi_header = (sapi_header_struct *)data;
 
        if (arg && sapi_header) {
-               add_next_index_string((zval *)arg, (char 
*)(sapi_header->header), 1);
+               add_next_index_ascii_string((zval *)arg, (char 
*)(sapi_header->header), 1);
        }
 }
 
-/* {{{ proto array headers_list(void)
+/* {{{ proto array headers_list(void) U
    Return list of headers to be sent / already sent */
 PHP_FUNCTION(headers_list)
 {
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/info.c?r1=1.269&r2=1.270&diff_format=u
Index: php-src/ext/standard/info.c
diff -u php-src/ext/standard/info.c:1.269 php-src/ext/standard/info.c:1.270
--- php-src/ext/standard/info.c:1.269   Tue Sep 19 10:38:31 2006
+++ php-src/ext/standard/info.c Thu Oct 19 20:55:08 2006
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: info.c,v 1.269 2006/09/19 10:38:31 dmitry Exp $ */
+/* $Id: info.c,v 1.270 2006/10/19 20:55:08 andrei Exp $ */
 
 #include "php.h"
 #include "php_ini.h"
@@ -1004,25 +1004,26 @@
 
 /* }}} */
 
-/* {{{ proto string phpversion([string extension])
+/* {{{ proto string phpversion([string extension]) U
    Return the current PHP version */
 PHP_FUNCTION(phpversion)
 {
-       zval **arg;
-       int argc = ZEND_NUM_ARGS();
+       char *ext_name = NULL;
+       int ext_name_len = 0;
+
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &ext_name, 
&ext_name_len) == FAILURE) {
+               return;
+       }
 
-       if (argc == 0) {
+       if (!ext_name) {
                RETURN_ASCII_STRING(PHP_VERSION, 1);
-       } else if (argc == 1 && zend_get_parameters_ex(1, &arg) == SUCCESS) {
+       } else {
                char *version;
-               convert_to_string_ex(arg);
-               version = zend_get_module_version(Z_STRVAL_PP(arg));
+               version = zend_get_module_version(ext_name);
                if (version == NULL) {
                        RETURN_FALSE;
                }
                RETURN_ASCII_STRING(version, 1);
-       } else {
-               WRONG_PARAM_COUNT;
        }
 }
 /* }}} */
@@ -1071,62 +1072,60 @@
 }
 /* }}} */
 
-/* {{{ proto string php_logo_guid(void)
+/* {{{ proto string php_logo_guid(void) U
    Return the special ID used to request the PHP logo in phpinfo screens*/
 PHP_FUNCTION(php_logo_guid)
 {
-
-       if (ZEND_NUM_ARGS() != 0) {
-               WRONG_PARAM_COUNT;
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
+               return;
        }
 
-       RETURN_ASCII_STRING(php_logo_guid(), 0);
+       RETURN_ASCII_STRING(php_logo_guid(), ZSTR_AUTOFREE);
 }
 /* }}} */
 
-/* {{{ proto string php_real_logo_guid(void)
+/* {{{ proto string php_real_logo_guid(void) U
    Return the special ID used to request the PHP logo in phpinfo screens*/
 PHP_FUNCTION(php_real_logo_guid)
 {
-
-       if (ZEND_NUM_ARGS() != 0) {
-               WRONG_PARAM_COUNT;
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
+               return;
        }
 
        RETURN_ASCII_STRINGL(PHP_LOGO_GUID, sizeof(PHP_LOGO_GUID)-1, 1);
 }
 /* }}} */
 
-/* {{{ proto string php_egg_logo_guid(void)
+/* {{{ proto string php_egg_logo_guid(void) U
    Return the special ID used to request the PHP logo in phpinfo screens*/
 PHP_FUNCTION(php_egg_logo_guid)
 {
-       if (ZEND_NUM_ARGS() != 0) {
-               WRONG_PARAM_COUNT;
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
+               return;
        }
 
        RETURN_ASCII_STRINGL(PHP_EGG_LOGO_GUID, sizeof(PHP_EGG_LOGO_GUID)-1, 1);
 }
 /* }}} */
 
-/* {{{ proto string zend_logo_guid(void)
+/* {{{ proto string zend_logo_guid(void) U
    Return the special ID used to request the Zend logo in phpinfo screens*/
 PHP_FUNCTION(zend_logo_guid)
 {
-       if (ZEND_NUM_ARGS() != 0) {
-               WRONG_PARAM_COUNT;
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
+               return;
        }
 
        RETURN_ASCII_STRINGL(ZEND_LOGO_GUID, sizeof(ZEND_LOGO_GUID)-1, 1);
 }
 /* }}} */
 
-/* {{{ proto string php_sapi_name(void)
+/* {{{ proto string php_sapi_name(void) U
    Return the current SAPI module name */
 PHP_FUNCTION(php_sapi_name)
 {
-       if (ZEND_NUM_ARGS() != 0) {
-               WRONG_PARAM_COUNT;
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
+               return;
        }
 
        if (sapi_module.name) {
@@ -1138,7 +1137,7 @@
 
 /* }}} */
 
-/* {{{ proto string php_uname(void)
+/* {{{ proto string php_uname(void) U
    Return information about the system PHP was built on */
 PHP_FUNCTION(php_uname)
 {
@@ -1150,20 +1149,17 @@
                return;
        }
        tmp = php_get_uname(*mode);
-       RETVAL_RT_STRING(tmp, 0);
-       if (UG(unicode)) {
-               efree(tmp);
-       }
+       RETVAL_RT_STRING(tmp, ZSTR_AUTOFREE);
 }
 
 /* }}} */
 
-/* {{{ proto string php_ini_scanned_files(void)
+/* {{{ proto string php_ini_scanned_files(void) U
    Return comma-separated string of .ini files parsed from the additional ini 
dir */
 PHP_FUNCTION(php_ini_scanned_files)
 {
        if (strlen(PHP_CONFIG_FILE_SCAN_DIR) && php_ini_scanned_files) {
-               RETURN_RT_STRING(php_ini_scanned_files, 1);
+               RETURN_RT_STRING(php_ini_scanned_files, ZSTR_DUPLICATE);
        } else {
                RETURN_FALSE;
        }

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

Reply via email to