com php-src: Add Z_PARAM_STRING/ARRAY_OR_NULL conveni ence macros: Zend/zend_API.h ext/date/php_date. c ext/pdo/pdo_dbh.c ext/pdo/pdo_stmt.c
ext/standa rd/basic_functions.c ext/standard/math.c ext/standard /proc_open.c ext/standard/streamsfuncs.c
| From: | Nikita Popov | Date: | Tue, 29 Oct 2019 12:29:52 +0000 |
| Subject: | com php-src: Add Z_PARAM_STRING/ARRAY_OR_NULL conveni ence macros: Zend/zend_API.h ext/date/php_date. c ext/pdo/pdo_dbh.c ext/pdo/pdo_stmt.c ext/standa rd/basic_functions.c ext/standard/math.c ext/standard /proc_open.c ext/standard/streamsfuncs.c |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-109117@lists.php.net to get a copy of this message | ||
Commit: 6719d3e7184e712aceb00750b1befc5701af7c1b
Author: Nikita Popov <nikita.ppv@gmail.com> Tue, 29 Oct 2019 13:29:52 +0100
Parents: 63a20cb400d064bc56254896dd8e1e921df27af8
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=6719d3e7184e712aceb00750b1befc5701af7c1b
Log:
Add Z_PARAM_STRING/ARRAY_OR_NULL convenience macros
Changed paths:
M Zend/zend_API.h
M ext/date/php_date.c
M ext/pdo/pdo_dbh.c
M ext/pdo/pdo_stmt.c
M ext/standard/basic_functions.c
M ext/standard/math.c
M ext/standard/proc_open.c
M ext/standard/streamsfuncs.c
Diff:
diff --git a/Zend/zend_API.h b/Zend/zend_API.h
index 0b9fcd76af4..cb97f5e94d9 100644
--- a/Zend/zend_API.h
+++ b/Zend/zend_API.h
@@ -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); \
diff --git a/ext/date/php_date.c b/ext/date/php_date.c
index dfad240fb17..6e878063eb2 100644
--- a/ext/date/php_date.c
+++ b/ext/date/php_date.c
@@ -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 */
diff --git a/ext/pdo/pdo_dbh.c b/ext/pdo/pdo_dbh.c
index 873aa2d6815..b3d4f243637 100644
--- a/ext/pdo/pdo_dbh.c
+++ b/ext/pdo/pdo_dbh.c
@@ -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();
diff --git a/ext/pdo/pdo_stmt.c b/ext/pdo/pdo_stmt.c
index 4acfcb00032..771c7a4ddef 100644
--- a/ext/pdo/pdo_stmt.c
+++ b/ext/pdo/pdo_stmt.c
@@ -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();
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c
index 1c3ad1d2bd2..80c1ea9ec38 100755
--- a/ext/standard/basic_functions.c
+++ b/ext/standard/basic_functions.c
@@ -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();
diff --git a/ext/standard/math.c b/ext/standard/math.c
index ef5beeb1601..18498a21d26 100644
--- a/ext/standard/math.c
+++ b/ext/standard/math.c
@@ -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()) {
diff --git a/ext/standard/proc_open.c b/ext/standard/proc_open.c
index 12e9820522b..166b4b03981 100644
--- a/ext/standard/proc_open.c
+++ b/ext/standard/proc_open.c
@@ -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));
diff --git a/ext/standard/streamsfuncs.c b/ext/standard/streamsfuncs.c
index 7c08083f5b6..89d5abd2514 100644
--- a/ext/standard/streamsfuncs.c
+++ b/ext/standard/streamsfuncs.c
@@ -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();