mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
- Introduce ZEND_NUM_ARGS(), to replace ARG_COUNT(ht)
- Rename getParameters() and friends for consistency and namespace cleanliness
This commit is contained in:
parent
21e53485dd
commit
cd7d5546ae
4 changed files with 31 additions and 30 deletions
|
@ -96,8 +96,8 @@ typedef unsigned char zend_bool;
|
||||||
#include "zend_hash.h"
|
#include "zend_hash.h"
|
||||||
#include "zend_llist.h"
|
#include "zend_llist.h"
|
||||||
|
|
||||||
#define INTERNAL_FUNCTION_PARAMETERS int ht, zval *return_value, HashTable *list, HashTable *plist, zval *this_ptr, int return_value_used
|
#define INTERNAL_FUNCTION_PARAMETERS int num_args, zval *return_value, HashTable *list, HashTable *plist, zval *this_ptr, int return_value_used
|
||||||
#define INTERNAL_FUNCTION_PARAM_PASSTHRU ht, return_value, list, plist, this_ptr, return_value_used
|
#define INTERNAL_FUNCTION_PARAM_PASSTHRU num_args, return_value, list, plist, this_ptr, return_value_used
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* zval
|
* zval
|
||||||
|
|
|
@ -35,7 +35,7 @@ static int module_count=0;
|
||||||
HashTable list_destructors, module_registry;
|
HashTable list_destructors, module_registry;
|
||||||
|
|
||||||
/* this function doesn't check for too many parameters */
|
/* this function doesn't check for too many parameters */
|
||||||
ZEND_API int getParameters(int ht, int param_count,...)
|
ZEND_API int zend_get_parameters(int ht, int param_count,...)
|
||||||
{
|
{
|
||||||
void **p;
|
void **p;
|
||||||
int arg_count;
|
int arg_count;
|
||||||
|
@ -75,7 +75,7 @@ ZEND_API int getParameters(int ht, int param_count,...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ZEND_API int getParametersArray(int ht, int param_count, zval **argument_array)
|
ZEND_API int zend_get_parameters_array(int ht, int param_count, zval **argument_array)
|
||||||
{
|
{
|
||||||
void **p;
|
void **p;
|
||||||
int arg_count;
|
int arg_count;
|
||||||
|
@ -115,7 +115,7 @@ ZEND_API int getParametersArray(int ht, int param_count, zval **argument_array)
|
||||||
|
|
||||||
/* Zend-optimized Extended functions */
|
/* Zend-optimized Extended functions */
|
||||||
/* this function doesn't check for too many parameters */
|
/* this function doesn't check for too many parameters */
|
||||||
ZEND_API int getParametersEx(int param_count,...)
|
ZEND_API int zend_get_parameters_ex(int param_count,...)
|
||||||
{
|
{
|
||||||
void **p;
|
void **p;
|
||||||
int arg_count;
|
int arg_count;
|
||||||
|
@ -141,7 +141,7 @@ ZEND_API int getParametersEx(int param_count,...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ZEND_API int getParametersArrayEx(int param_count, zval ***argument_array)
|
ZEND_API int zend_get_parameters_array_ex(int param_count, zval ***argument_array)
|
||||||
{
|
{
|
||||||
void **p;
|
void **p;
|
||||||
int arg_count;
|
int arg_count;
|
||||||
|
|
|
@ -56,10 +56,10 @@
|
||||||
|
|
||||||
int zend_next_free_module(void);
|
int zend_next_free_module(void);
|
||||||
|
|
||||||
ZEND_API int getParameters(int ht, int param_count,...);
|
ZEND_API int zend_get_parameters(int ht, int param_count,...);
|
||||||
ZEND_API int getParametersArray(int ht, int param_count, zval **argument_array);
|
ZEND_API int zend_get_parameters_array(int ht, int param_count, zval **argument_array);
|
||||||
ZEND_API int getParametersEx(int param_count,...);
|
ZEND_API int zend_get_parameters_ex(int param_count,...);
|
||||||
ZEND_API int getParametersArrayEx(int param_count, zval ***argument_array);
|
ZEND_API int zend_get_parameters_array_ex(int param_count, zval ***argument_array);
|
||||||
|
|
||||||
ZEND_API int ParameterPassedByReference(int ht, uint n);
|
ZEND_API int ParameterPassedByReference(int ht, uint n);
|
||||||
|
|
||||||
|
@ -75,7 +75,8 @@ ZEND_API void wrong_param_count(void);
|
||||||
|
|
||||||
#define WRONG_PARAM_COUNT { wrong_param_count(); return; }
|
#define WRONG_PARAM_COUNT { wrong_param_count(); return; }
|
||||||
#define WRONG_PARAM_COUNT_WITH_RETVAL(ret) { wrong_param_count(); return ret; }
|
#define WRONG_PARAM_COUNT_WITH_RETVAL(ret) { wrong_param_count(); return ret; }
|
||||||
#define ARG_COUNT(ht) (ht)
|
#define ARG_COUNT(dummy) (num_args)
|
||||||
|
#define ZEND_NUM_ARGS() (num_args)
|
||||||
|
|
||||||
#define BYREF_NONE 0
|
#define BYREF_NONE 0
|
||||||
#define BYREF_FORCE 1
|
#define BYREF_FORCE 1
|
||||||
|
|
|
@ -113,7 +113,7 @@ ZEND_FUNCTION(func_get_arg)
|
||||||
long requested_offset;
|
long requested_offset;
|
||||||
ELS_FETCH();
|
ELS_FETCH();
|
||||||
|
|
||||||
if (ARG_COUNT(ht)!=1 || getParametersEx(1, &z_requested_offset)==FAILURE) {
|
if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &z_requested_offset)==FAILURE) {
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
convert_to_long_ex(z_requested_offset);
|
convert_to_long_ex(z_requested_offset);
|
||||||
|
@ -177,7 +177,7 @@ ZEND_FUNCTION(strlen)
|
||||||
{
|
{
|
||||||
zval **str;
|
zval **str;
|
||||||
|
|
||||||
if (ARG_COUNT(ht) != 1 || getParametersEx(1, &str) == FAILURE) {
|
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &str) == FAILURE) {
|
||||||
WRONG_PARAM_COUNT;
|
WRONG_PARAM_COUNT;
|
||||||
}
|
}
|
||||||
convert_to_string_ex(str);
|
convert_to_string_ex(str);
|
||||||
|
@ -191,7 +191,7 @@ ZEND_FUNCTION(strcmp)
|
||||||
{
|
{
|
||||||
zval **s1, **s2;
|
zval **s1, **s2;
|
||||||
|
|
||||||
if (ARG_COUNT(ht) != 2 || getParametersEx(2, &s1, &s2) == FAILURE) {
|
if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &s1, &s2) == FAILURE) {
|
||||||
WRONG_PARAM_COUNT;
|
WRONG_PARAM_COUNT;
|
||||||
}
|
}
|
||||||
convert_to_string_ex(s1);
|
convert_to_string_ex(s1);
|
||||||
|
@ -206,7 +206,7 @@ ZEND_FUNCTION(strcasecmp)
|
||||||
{
|
{
|
||||||
zval **s1, **s2;
|
zval **s1, **s2;
|
||||||
|
|
||||||
if (ARG_COUNT(ht)!=2 || getParametersEx(2, &s1, &s2) == FAILURE) {
|
if (ZEND_NUM_ARGS()!=2 || zend_get_parameters_ex(2, &s1, &s2) == FAILURE) {
|
||||||
WRONG_PARAM_COUNT;
|
WRONG_PARAM_COUNT;
|
||||||
}
|
}
|
||||||
convert_to_string_ex(s1);
|
convert_to_string_ex(s1);
|
||||||
|
@ -223,7 +223,7 @@ ZEND_FUNCTION(each)
|
||||||
zval **inserted_pointer;
|
zval **inserted_pointer;
|
||||||
HashTable *target_hash;
|
HashTable *target_hash;
|
||||||
|
|
||||||
if (ARG_COUNT(ht) != 1 || getParametersEx(1, &array) == FAILURE) {
|
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &array) == FAILURE) {
|
||||||
WRONG_PARAM_COUNT;
|
WRONG_PARAM_COUNT;
|
||||||
}
|
}
|
||||||
target_hash = HASH_OF(*array);
|
target_hash = HASH_OF(*array);
|
||||||
|
@ -272,11 +272,11 @@ ZEND_FUNCTION(error_reporting)
|
||||||
ELS_FETCH();
|
ELS_FETCH();
|
||||||
|
|
||||||
old_error_reporting = EG(error_reporting);
|
old_error_reporting = EG(error_reporting);
|
||||||
switch (ARG_COUNT(ht)) {
|
switch (ZEND_NUM_ARGS()) {
|
||||||
case 0:
|
case 0:
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
if (getParametersEx(1,&arg) == FAILURE) {
|
if (zend_get_parameters_ex(1,&arg) == FAILURE) {
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
convert_to_long_ex(arg);
|
convert_to_long_ex(arg);
|
||||||
|
@ -297,15 +297,15 @@ ZEND_FUNCTION(define)
|
||||||
zend_constant c;
|
zend_constant c;
|
||||||
ELS_FETCH();
|
ELS_FETCH();
|
||||||
|
|
||||||
switch(ARG_COUNT(ht)) {
|
switch(ZEND_NUM_ARGS()) {
|
||||||
case 2:
|
case 2:
|
||||||
if (getParametersEx(2, &var, &val)==FAILURE) {
|
if (zend_get_parameters_ex(2, &var, &val)==FAILURE) {
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
case_sensitive = CONST_CS;
|
case_sensitive = CONST_CS;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
if (getParametersEx(3, &var, &val, &non_cs)==FAILURE) {
|
if (zend_get_parameters_ex(3, &var, &val, &non_cs)==FAILURE) {
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
convert_to_long_ex(non_cs);
|
convert_to_long_ex(non_cs);
|
||||||
|
@ -348,7 +348,7 @@ ZEND_FUNCTION(defined)
|
||||||
zval **var;
|
zval **var;
|
||||||
zval c;
|
zval c;
|
||||||
|
|
||||||
if (ARG_COUNT(ht)!=1 || getParametersEx(1, &var)==FAILURE) {
|
if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &var)==FAILURE) {
|
||||||
WRONG_PARAM_COUNT;
|
WRONG_PARAM_COUNT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -368,7 +368,7 @@ ZEND_FUNCTION(get_class)
|
||||||
{
|
{
|
||||||
zval **arg;
|
zval **arg;
|
||||||
|
|
||||||
if (ARG_COUNT(ht)!=1 || getParametersEx(1, &arg)==FAILURE) {
|
if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &arg)==FAILURE) {
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
if ((*arg)->type != IS_OBJECT) {
|
if ((*arg)->type != IS_OBJECT) {
|
||||||
|
@ -385,7 +385,7 @@ ZEND_FUNCTION(get_parent_class)
|
||||||
{
|
{
|
||||||
zval **arg;
|
zval **arg;
|
||||||
|
|
||||||
if (ARG_COUNT(ht)!=1 || getParametersEx(1, &arg)==FAILURE) {
|
if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &arg)==FAILURE) {
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
if (((*arg)->type != IS_OBJECT) || !(*arg)->value.obj.ce->parent) {
|
if (((*arg)->type != IS_OBJECT) || !(*arg)->value.obj.ce->parent) {
|
||||||
|
@ -404,7 +404,7 @@ ZEND_FUNCTION(is_subclass_of)
|
||||||
zend_class_entry *parent_ce = NULL;
|
zend_class_entry *parent_ce = NULL;
|
||||||
CLS_FETCH();
|
CLS_FETCH();
|
||||||
|
|
||||||
if (ARG_COUNT(ht) != 2 || getParametersEx(2, &obj, &class_name)==FAILURE) {
|
if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &obj, &class_name)==FAILURE) {
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -435,7 +435,7 @@ ZEND_FUNCTION(method_exists)
|
||||||
zval **klass, **method_name;
|
zval **klass, **method_name;
|
||||||
char *lcname;
|
char *lcname;
|
||||||
|
|
||||||
if (ARG_COUNT(ht)!=2 || getParametersEx(2, &klass, &method_name)==FAILURE) {
|
if (ZEND_NUM_ARGS()!=2 || zend_get_parameters_ex(2, &klass, &method_name)==FAILURE) {
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
if ((*klass)->type != IS_OBJECT) {
|
if ((*klass)->type != IS_OBJECT) {
|
||||||
|
@ -463,7 +463,7 @@ ZEND_FUNCTION(class_exists)
|
||||||
char *lcname;
|
char *lcname;
|
||||||
CLS_FETCH();
|
CLS_FETCH();
|
||||||
|
|
||||||
if (ARG_COUNT(ht) != 1 || getParametersEx(1, &class_name)==FAILURE) {
|
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &class_name)==FAILURE) {
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
convert_to_string_ex(class_name);
|
convert_to_string_ex(class_name);
|
||||||
|
@ -487,7 +487,7 @@ ZEND_FUNCTION(function_exists)
|
||||||
char *lcname;
|
char *lcname;
|
||||||
CLS_FETCH();
|
CLS_FETCH();
|
||||||
|
|
||||||
if (ARG_COUNT(ht)!=1 || getParametersEx(1, &function_name)==FAILURE) {
|
if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &function_name)==FAILURE) {
|
||||||
WRONG_PARAM_COUNT;
|
WRONG_PARAM_COUNT;
|
||||||
}
|
}
|
||||||
convert_to_string_ex(function_name);
|
convert_to_string_ex(function_name);
|
||||||
|
@ -508,8 +508,8 @@ ZEND_FUNCTION(leak)
|
||||||
int leakbytes=3;
|
int leakbytes=3;
|
||||||
zval **leak;
|
zval **leak;
|
||||||
|
|
||||||
if (ARG_COUNT(ht)>=1) {
|
if (ZEND_NUM_ARGS()>=1) {
|
||||||
if (getParametersEx(1, &leak)==SUCCESS) {
|
if (zend_get_parameters_ex(1, &leak)==SUCCESS) {
|
||||||
convert_to_long_ex(leak);
|
convert_to_long_ex(leak);
|
||||||
leakbytes = (*leak)->value.lval;
|
leakbytes = (*leak)->value.lval;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue