mirror of
https://github.com/php/php-src.git
synced 2024-09-21 09:57:23 +00:00
Add Z_PARAM_STRING/ARRAY_OR_NULL convenience macros
This commit is contained in:
parent
63a20cb400
commit
6719d3e718
@ -1226,6 +1226,9 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_callback_error(int num, char *e
|
||||
#define Z_PARAM_ARRAY(dest) \
|
||||
Z_PARAM_ARRAY_EX(dest, 0, 0)
|
||||
|
||||
#define Z_PARAM_ARRAY_OR_NULL(dest) \
|
||||
Z_PARAM_ARRAY_EX(dest, 1, 0)
|
||||
|
||||
/* old "A" */
|
||||
#define Z_PARAM_ARRAY_OR_OBJECT_EX2(dest, check_null, deref, separate) \
|
||||
Z_PARAM_PROLOGUE(deref, separate); \
|
||||
@ -1463,6 +1466,9 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_callback_error(int num, char *e
|
||||
#define Z_PARAM_STRING(dest, dest_len) \
|
||||
Z_PARAM_STRING_EX(dest, dest_len, 0, 0)
|
||||
|
||||
#define Z_PARAM_STRING_OR_NULL(dest, dest_len) \
|
||||
Z_PARAM_STRING_EX(dest, dest_len, 1, 0)
|
||||
|
||||
/* old "S" */
|
||||
#define Z_PARAM_STR_EX2(dest, check_null, deref, separate) \
|
||||
Z_PARAM_PROLOGUE(deref, separate); \
|
||||
|
@ -4444,7 +4444,7 @@ PHP_FUNCTION(timezone_identifiers_list)
|
||||
ZEND_PARSE_PARAMETERS_START(0, 2)
|
||||
Z_PARAM_OPTIONAL
|
||||
Z_PARAM_LONG(what)
|
||||
Z_PARAM_STRING_EX(option, option_len, 1, 0)
|
||||
Z_PARAM_STRING_OR_NULL(option, option_len)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
/* Extra validation */
|
||||
|
@ -210,9 +210,9 @@ static PHP_METHOD(PDO, dbh_constructor)
|
||||
ZEND_PARSE_PARAMETERS_START(1, 4)
|
||||
Z_PARAM_STRING(data_source, data_source_len)
|
||||
Z_PARAM_OPTIONAL
|
||||
Z_PARAM_STRING_EX(username, usernamelen, 1, 0)
|
||||
Z_PARAM_STRING_EX(password, passwordlen, 1, 0)
|
||||
Z_PARAM_ARRAY_EX(options, 1, 0)
|
||||
Z_PARAM_STRING_OR_NULL(username, usernamelen)
|
||||
Z_PARAM_STRING_OR_NULL(password, passwordlen)
|
||||
Z_PARAM_ARRAY_OR_NULL(options)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
/* parse the data source name */
|
||||
@ -938,7 +938,7 @@ static PHP_METHOD(PDO, lastInsertId)
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(0, 1)
|
||||
Z_PARAM_OPTIONAL
|
||||
Z_PARAM_STRING_EX(name, namelen, 1, 0)
|
||||
Z_PARAM_STRING_OR_NULL(name, namelen)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
PDO_DBH_CLEAR_ERR();
|
||||
|
@ -423,7 +423,7 @@ static PHP_METHOD(PDOStatement, execute)
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(0, 1)
|
||||
Z_PARAM_OPTIONAL
|
||||
Z_PARAM_ARRAY_EX(input_params, 1, 0)
|
||||
Z_PARAM_ARRAY_OR_NULL(input_params)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
PDO_STMT_CLEAR_ERR();
|
||||
|
@ -4413,7 +4413,7 @@ PHP_FUNCTION(ini_get_all)
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(0, 2)
|
||||
Z_PARAM_OPTIONAL
|
||||
Z_PARAM_STRING_EX(extname, extname_len, 1, 0)
|
||||
Z_PARAM_STRING_OR_NULL(extname, extname_len)
|
||||
Z_PARAM_BOOL(details)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
|
@ -1251,8 +1251,8 @@ PHP_FUNCTION(number_format)
|
||||
Z_PARAM_DOUBLE(num)
|
||||
Z_PARAM_OPTIONAL
|
||||
Z_PARAM_LONG(dec)
|
||||
Z_PARAM_STRING_EX(dec_point, dec_point_len, 1, 0)
|
||||
Z_PARAM_STRING_EX(thousand_sep, thousand_sep_len, 1, 0)
|
||||
Z_PARAM_STRING_OR_NULL(dec_point, dec_point_len)
|
||||
Z_PARAM_STRING_OR_NULL(thousand_sep, thousand_sep_len)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
switch(ZEND_NUM_ARGS()) {
|
||||
|
@ -518,9 +518,9 @@ PHP_FUNCTION(proc_open)
|
||||
Z_PARAM_ARRAY(descriptorspec)
|
||||
Z_PARAM_ZVAL(pipes)
|
||||
Z_PARAM_OPTIONAL
|
||||
Z_PARAM_STRING_EX(cwd, cwd_len, 1, 0)
|
||||
Z_PARAM_ARRAY_EX(environment, 1, 0)
|
||||
Z_PARAM_ARRAY_EX(other_options, 1, 0)
|
||||
Z_PARAM_STRING_OR_NULL(cwd, cwd_len)
|
||||
Z_PARAM_ARRAY_OR_NULL(environment)
|
||||
Z_PARAM_ARRAY_OR_NULL(other_options)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
memset(&env, 0, sizeof(env));
|
||||
|
@ -1128,8 +1128,8 @@ PHP_FUNCTION(stream_context_create)
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(0, 2)
|
||||
Z_PARAM_OPTIONAL
|
||||
Z_PARAM_ARRAY_EX(options, 1, 0)
|
||||
Z_PARAM_ARRAY_EX(params, 1, 0)
|
||||
Z_PARAM_ARRAY_OR_NULL(options)
|
||||
Z_PARAM_ARRAY_OR_NULL(params)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
context = php_stream_context_alloc();
|
||||
|
Loading…
Reference in New Issue
Block a user