]> granicus.if.org Git - php/commitdiff
Pick some low-hanging fruit.
authorAndrei Zmievski <andrei@php.net>
Thu, 19 Oct 2006 20:55:08 +0000 (20:55 +0000)
committerAndrei Zmievski <andrei@php.net>
Thu, 19 Oct 2006 20:55:08 +0000 (20:55 +0000)
ext/standard/head.c
ext/standard/info.c

index 60c4ae5bc0c4a7f7696a5fa6d9d14c667bfea114..3b959653f3920a424f313a16a9157a91d9ef85ac 100644 (file)
@@ -247,11 +247,11 @@ static void php_head_apply_header_list_to_hash(void *data, void *arg TSRMLS_DC)
        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)
 {
index 491308e48929137c58f90828d3aba126e9f17357..c1fe532128de0286933d3d4de727ab011260e36c 100644 (file)
@@ -1004,25 +1004,26 @@ PHP_FUNCTION(phpinfo)
 
 /* }}} */
 
-/* {{{ 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 @@ PHPAPI char *php_logo_guid()
 }
 /* }}} */
 
-/* {{{ 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 @@ PHP_FUNCTION(php_sapi_name)
 
 /* }}} */
 
-/* {{{ 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 @@ PHP_FUNCTION(php_uname)
                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;
        }