diff options
author | Rasmus Lerdorf <rasmus@php.net> | 2001-08-13 07:55:39 +0000 |
---|---|---|
committer | Rasmus Lerdorf <rasmus@php.net> | 2001-08-13 07:55:39 +0000 |
commit | 4d11d90880e63aaf125d09140775efdb287b9704 (patch) | |
tree | 00ed223eb953c2286b1b557548fbc4f73000f55c /ext | |
parent | 5b2227ea80b0fc5be46bfbdd9dd5ce4ac7825717 (diff) | |
download | php-git-4d11d90880e63aaf125d09140775efdb287b9704.tar.gz |
Track down a few more functions that don't check for 0 args and use
faster mechanism
Diffstat (limited to 'ext')
-rw-r--r-- | ext/curl/curl.c | 5 | ||||
-rw-r--r-- | ext/db/db.c | 5 | ||||
-rw-r--r-- | ext/domxml/php_domxml.c | 5 | ||||
-rw-r--r-- | ext/fdf/fdf.c | 5 | ||||
-rw-r--r-- | ext/gd/gd.c | 5 | ||||
-rw-r--r-- | ext/hyperwave/hw.c | 5 | ||||
-rw-r--r-- | ext/interbase/interbase.c | 5 | ||||
-rw-r--r-- | ext/mhash/mhash.c | 5 | ||||
-rw-r--r-- | ext/odbc/php_odbc.c | 5 | ||||
-rw-r--r-- | ext/sablot/sablot.c | 11 | ||||
-rw-r--r-- | ext/session/session.c | 10 | ||||
-rw-r--r-- | ext/snmp/snmp.c | 6 | ||||
-rw-r--r-- | ext/sockets/sockets.c | 5 | ||||
-rw-r--r-- | ext/standard/basic_functions.c | 6 | ||||
-rw-r--r-- | ext/standard/head.c | 4 | ||||
-rw-r--r-- | ext/standard/info.c | 30 | ||||
-rw-r--r-- | ext/standard/rand.c | 8 |
17 files changed, 79 insertions, 46 deletions
diff --git a/ext/curl/curl.c b/ext/curl/curl.c index 21c2641111..6e97eaafca 100644 --- a/ext/curl/curl.c +++ b/ext/curl/curl.c @@ -504,8 +504,9 @@ static void curl_free_slist(void **slist) Return the CURL version string. */ PHP_FUNCTION(curl_version) { - if (zend_parse_parameters(ZEND_NUM_ARGS(), "") == FAILURE) - return; + if (ZEND_NUM_ARGS() != 0) { + WRONG_PARAM_COUNT; + } RETURN_STRING(curl_version(), 1); } diff --git a/ext/db/db.c b/ext/db/db.c index cf0712da71..6ea3bdb83a 100644 --- a/ext/db/db.c +++ b/ext/db/db.c @@ -252,8 +252,9 @@ PHP_MINFO_FUNCTION(db) Describes the dbm-compatible library being used */ PHP_FUNCTION(dblist) { - if (zend_parse_parameters(ZEND_NUM_ARGS(), "") == FAILURE) - return; + if (ZEND_NUM_ARGS() != 0) { + WRONG_PARAM_COUNT; + } char *str = php_get_info_db(); RETURN_STRING(str, 1); diff --git a/ext/domxml/php_domxml.c b/ext/domxml/php_domxml.c index d1a3042a11..10a0849c60 100644 --- a/ext/domxml/php_domxml.c +++ b/ext/domxml/php_domxml.c @@ -2432,8 +2432,9 @@ PHP_FUNCTION(xmltree) Initializing XPath environment */ PHP_FUNCTION(xpath_init) { - if (zend_parse_parameters(ZEND_NUM_ARGS(), "") == FAILURE) - return; + if (ZEND_NUM_ARGS() != 0) { + WRONG_PARAM_COUNT; + } xmlXPathInit(); RETURN_TRUE; diff --git a/ext/fdf/fdf.c b/ext/fdf/fdf.c index f09b7433da..08a9d00563 100644 --- a/ext/fdf/fdf.c +++ b/ext/fdf/fdf.c @@ -209,8 +209,9 @@ PHP_FUNCTION(fdf_create) FDFDoc fdf; FDFErc err; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "") == FAILURE) - return; + if (ZEND_NUM_ARGS() != 0) { + WRONG_PARAM_COUNT; + } err = FDFCreate(&fdf); diff --git a/ext/gd/gd.c b/ext/gd/gd.c index e00f3c26e7..a0a96742d3 100644 --- a/ext/gd/gd.c +++ b/ext/gd/gd.c @@ -931,8 +931,9 @@ PHP_FUNCTION(imagetypes) #ifdef HAVE_GD_XPM ret |= 16; #endif - if (zend_parse_parameters(ZEND_NUM_ARGS(), "") == FAILURE) - return; + if (ZEND_NUM_ARGS() != 0) { + WRONG_PARAM_COUNT; + } RETURN_LONG(ret); } diff --git a/ext/hyperwave/hw.c b/ext/hyperwave/hw.c index a00e1c7fa3..077a7ae263 100644 --- a/ext/hyperwave/hw.c +++ b/ext/hyperwave/hw.c @@ -1331,8 +1331,9 @@ PHP_FUNCTION(hw_errormsg) Returns object id of root collection */ PHP_FUNCTION(hw_root) { - if (zend_parse_parameters(ZEND_NUM_ARGS(), "") == FAILURE) - return; + if (ZEND_NUM_ARGS() != 0) { + WRONG_PARAM_COUNT; + } return_value->value.lval = 0; return_value->type = IS_LONG; diff --git a/ext/interbase/interbase.c b/ext/interbase/interbase.c index 0ed2c2412a..05d66f1dec 100644 --- a/ext/interbase/interbase.c +++ b/ext/interbase/interbase.c @@ -236,8 +236,9 @@ typedef struct { Return error message */ PHP_FUNCTION(ibase_errmsg) { - if (zend_parse_parameters(ZEND_NUM_ARGS(), "") == FAILURE) - return; + if (ZEND_NUM_ARGS() != 0) { + WRONG_PARAM_COUNT; + } if (IBG(errmsg[0])) { RETURN_STRING(IBG(errmsg), 1); diff --git a/ext/mhash/mhash.c b/ext/mhash/mhash.c index d6ad84c7cf..68950f9bfc 100644 --- a/ext/mhash/mhash.c +++ b/ext/mhash/mhash.c @@ -83,8 +83,9 @@ static PHP_MINIT_FUNCTION(mhash) Gets the number of available hashes */ PHP_FUNCTION(mhash_count) { - if (zend_parse_parameters(ZEND_NUM_ARGS(), "") == FAILURE) - return; + if (ZEND_NUM_ARGS() != 0) { + WRONG_PARAM_COUNT; + } RETURN_LONG(mhash_count()); } diff --git a/ext/odbc/php_odbc.c b/ext/odbc/php_odbc.c index 951e35a161..14dc9093a1 100644 --- a/ext/odbc/php_odbc.c +++ b/ext/odbc/php_odbc.c @@ -711,8 +711,9 @@ PHP_FUNCTION(odbc_close_all) int i; int nument; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "") == FAILURE) - return; + if (ZEND_NUM_ARGS() != 0) { + WRONG_PARAM_COUNT; + } nument = zend_hash_next_free_element(&EG(regular_list)); diff --git a/ext/sablot/sablot.c b/ext/sablot/sablot.c index 3d1a73609f..228b52e298 100644 --- a/ext/sablot/sablot.c +++ b/ext/sablot/sablot.c @@ -292,8 +292,9 @@ PHP_FUNCTION(xslt_output_endtransform) *buffer = NULL; int ret = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "") == FAILURE) - return; + if (ZEND_NUM_ARGS() != 0) { + WRONG_PARAM_COUNT; + } /** * Make sure that we don't have more than one output buffer going on @@ -551,7 +552,6 @@ PHP_FUNCTION(xslt_process) } /* }}} */ - /* {{{ proto resource xslt_create(void) Create a new XSL processor and return a resource identifier. */ PHP_FUNCTION(xslt_create) @@ -560,8 +560,9 @@ PHP_FUNCTION(xslt_create) SablotHandle p; int ret; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "") == FAILURE) - return; + if (ZEND_NUM_ARGS() != 0) { + WRONG_PARAM_COUNT; + } ret = SablotCreateProcessor(&p); diff --git a/ext/session/session.c b/ext/session/session.c index 7ed6ad84d9..491b58f318 100644 --- a/ext/session/session.c +++ b/ext/session/session.c @@ -1229,8 +1229,9 @@ PHP_FUNCTION(session_encode) int len; char *enc; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "") == FAILURE) - return; + if (ZEND_NUM_ARGS() != 0) { + WRONG_PARAM_COUNT; + } enc = php_session_encode(&len TSRMLS_CC); RETVAL_STRINGL(enc, len, 0); @@ -1266,8 +1267,9 @@ PHP_FUNCTION(session_start) Destroy the current session and all data associated with it */ PHP_FUNCTION(session_destroy) { - if (zend_parse_parameters(ZEND_NUM_ARGS(), "") == FAILURE) - return; + if (ZEND_NUM_ARGS() != 0) { + WRONG_PARAM_COUNT; + } if (php_session_destroy(TSRMLS_C) == SUCCESS) { RETURN_TRUE; diff --git a/ext/snmp/snmp.c b/ext/snmp/snmp.c index 56c87e4dc4..810642bb1d 100644 --- a/ext/snmp/snmp.c +++ b/ext/snmp/snmp.c @@ -402,8 +402,9 @@ PHP_FUNCTION(snmprealwalk) Return the current status of quick_print */ PHP_FUNCTION(snmp_get_quick_print) { - if (zend_parse_parameters(ZEND_NUM_ARGS(), "") == FAILURE) - return; + if (ZEND_NUM_ARGS() != 0) { + WRONG_PARAM_COUNT; + } RETURN_LONG(snmp_get_quick_print() ? 1 : 0); } @@ -418,6 +419,7 @@ PHP_FUNCTION(snmp_set_quick_print) if (zend_parse_parameters(argc, "l", &a1) == FAILURE) return; + snmp_set_quick_print((int)a1); } /* }}} */ diff --git a/ext/sockets/sockets.c b/ext/sockets/sockets.c index d8629f0b42..49963044ef 100644 --- a/ext/sockets/sockets.c +++ b/ext/sockets/sockets.c @@ -397,8 +397,9 @@ PHP_FUNCTION(socket_fd_alloc) { php_fd_set *php_fd; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "") == FAILURE) - return; + if (ZEND_NUM_ARGS() != 0) { + WRONG_PARAM_COUNT; + } php_fd = (php_fd_set*)emalloc(sizeof(php_fd_set)); diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 17b093bf59..2fd601bf42 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -1316,8 +1316,9 @@ PHP_FUNCTION(settype) Get the name of the owner of the current PHP script */ PHP_FUNCTION(get_current_user) { - if (zend_parse_parameters(ZEND_NUM_ARGS(), "") == FAILURE) - return; + if (ZEND_NUM_ARGS() != 0) { + WRONG_PARAM_COUNT; + } RETURN_STRING(php_get_current_user(), 1); } @@ -1343,7 +1344,6 @@ PHP_FUNCTION(get_cfg_var) } /* }}} */ - /* {{{ proto bool set_magic_quotes_runtime(int new_setting) Set the current active configuration setting of magic_quotes_runtime and return previous */ PHP_FUNCTION(set_magic_quotes_runtime) diff --git a/ext/standard/head.c b/ext/standard/head.c index 532cd7c5a6..38f8438f7f 100644 --- a/ext/standard/head.c +++ b/ext/standard/head.c @@ -180,6 +180,10 @@ PHP_FUNCTION(setcookie) Return true if headers have already been sent, false otherwise */ PHP_FUNCTION(headers_sent) { + if (ZEND_NUM_ARGS() != 0) { + WRONG_PARAM_COUNT; + } + if (SG(headers_sent)) { RETURN_TRUE; } else { diff --git a/ext/standard/info.c b/ext/standard/info.c index ca41591ca3..0fa5414a1d 100644 --- a/ext/standard/info.c +++ b/ext/standard/info.c @@ -476,8 +476,9 @@ PHP_FUNCTION(phpinfo) Return the current PHP version */ PHP_FUNCTION(phpversion) { - if (zend_parse_parameters(ZEND_NUM_ARGS(), "") == FAILURE) - return; + if (ZEND_NUM_ARGS() != 0) { + WRONG_PARAM_COUNT; + } RETURN_STRING(PHP_VERSION, 1); } @@ -506,8 +507,9 @@ PHP_FUNCTION(phpcredits) Return the special ID used to request the PHP logo in phpinfo screens*/ PHP_FUNCTION(php_logo_guid) { - if (zend_parse_parameters(ZEND_NUM_ARGS(), "") == FAILURE) - return; + if (ZEND_NUM_ARGS() != 0) { + WRONG_PARAM_COUNT; + } RETURN_STRINGL(PHP_LOGO_GUID, sizeof(PHP_LOGO_GUID)-1, 1); } @@ -517,8 +519,9 @@ PHP_FUNCTION(php_logo_guid) Return the special ID used to request the PHP logo in phpinfo screens*/ PHP_FUNCTION(php_egg_logo_guid) { - if (zend_parse_parameters(ZEND_NUM_ARGS(), "") == FAILURE) - return; + if (ZEND_NUM_ARGS() != 0) { + WRONG_PARAM_COUNT; + } RETURN_STRINGL(PHP_EGG_LOGO_GUID, sizeof(PHP_EGG_LOGO_GUID)-1, 1); } @@ -528,8 +531,9 @@ PHP_FUNCTION(php_egg_logo_guid) Return the special ID used to request the Zend logo in phpinfo screens*/ PHP_FUNCTION(zend_logo_guid) { - if (zend_parse_parameters(ZEND_NUM_ARGS(), "") == FAILURE) - return; + if (ZEND_NUM_ARGS() != 0) { + WRONG_PARAM_COUNT; + } RETURN_STRINGL(ZEND_LOGO_GUID, sizeof(ZEND_LOGO_GUID)-1, 1); } @@ -539,8 +543,9 @@ PHP_FUNCTION(zend_logo_guid) Return the current SAPI module name */ PHP_FUNCTION(php_sapi_name) { - if (zend_parse_parameters(ZEND_NUM_ARGS(), "") == FAILURE) - return; + if (ZEND_NUM_ARGS() != 0) { + WRONG_PARAM_COUNT; + } if (sapi_module.name) { RETURN_STRING(sapi_module.name, 1); @@ -555,8 +560,9 @@ PHP_FUNCTION(php_sapi_name) Return information about the system PHP was built on */ PHP_FUNCTION(php_uname) { - if (zend_parse_parameters(ZEND_NUM_ARGS(), "") == FAILURE) - return; + if (ZEND_NUM_ARGS() != 0) { + WRONG_PARAM_COUNT; + } RETURN_STRING(php_get_uname(), 0); } diff --git a/ext/standard/rand.c b/ext/standard/rand.c index 567ee7277a..4ac3bc0507 100644 --- a/ext/standard/rand.c +++ b/ext/standard/rand.c @@ -329,6 +329,10 @@ PHP_FUNCTION(mt_rand) Returns the maximum value a random number can have */ PHP_FUNCTION(getrandmax) { + if (ZEND_NUM_ARGS() != 0) { + WRONG_PARAM_COUNT; + } + return_value->type = IS_LONG; return_value->value.lval = PHP_RAND_MAX; } @@ -338,6 +342,10 @@ PHP_FUNCTION(getrandmax) Returns the maximum value a random number from Mersenne Twister can have */ PHP_FUNCTION(mt_getrandmax) { + if (ZEND_NUM_ARGS() != 0) { + WRONG_PARAM_COUNT; + } + return_value->type = IS_LONG; /* * Melo: it could be 2^^32 but we only use 2^^31 to maintain |