Browse Source

Track down a few more functions that don't check for 0 args and use

faster mechanism
migration/unlabaled-1.67.2
Rasmus Lerdorf 25 years ago
parent
commit
4d11d90880
  1. 5
      ext/curl/curl.c
  2. 5
      ext/db/db.c
  3. 5
      ext/domxml/php_domxml.c
  4. 5
      ext/fdf/fdf.c
  5. 5
      ext/gd/gd.c
  6. 5
      ext/hyperwave/hw.c
  7. 5
      ext/interbase/interbase.c
  8. 5
      ext/mhash/mhash.c
  9. 5
      ext/odbc/php_odbc.c
  10. 11
      ext/sablot/sablot.c
  11. 10
      ext/session/session.c
  12. 6
      ext/snmp/snmp.c
  13. 5
      ext/sockets/sockets.c
  14. 6
      ext/standard/basic_functions.c
  15. 4
      ext/standard/head.c
  16. 30
      ext/standard/info.c
  17. 8
      ext/standard/rand.c

5
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);
}

5
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);

5
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;

5
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);

5
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);
}

5
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;

5
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);

5
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());
}

5
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));

11
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);

10
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;

6
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);
}
/* }}} */

5
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));

6
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)

4
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 {

30
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);
}

8
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

Loading…
Cancel
Save