com php-src: Use new param API in standard: ext/standard/base64.c ext/standard/filestat.c ext/standard/formatted_print.c ex t/standard/quot_print.c
ext/standard/syslog.c
| From: | Sara Golemon | Date: | Fri, 30 Dec 2016 17:12:17 +0000 |
| Subject: | com php-src: Use new param API in standard: ext/standard/base64.c ext/standard/filestat.c ext/standard/formatted_print.c ex t/standard/quot_print.c ext/standard/syslog.c |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-96449@lists.php.net to get a copy of this message | ||
Commit: 54c13295a6599c39a97fba98bf9fdf69b1706429
Author: Sara Golemon <pollita@php.net> Fri, 30 Dec 2016 08:54:55 -0800
Parents: c5cc583473ad6dab3712cd4589357a9e90f8d42a
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=54c13295a6599c39a97fba98bf9fdf69b1706429
Log:
Use new param API in standard
Changed paths:
M ext/standard/base64.c
M ext/standard/filestat.c
M ext/standard/formatted_print.c
M ext/standard/quot_print.c
M ext/standard/syslog.c
Diff:
diff --git a/ext/standard/base64.c b/ext/standard/base64.c
index cd6bac0..6269807 100644
--- a/ext/standard/base64.c
+++ b/ext/standard/base64.c
@@ -213,9 +213,10 @@ PHP_FUNCTION(base64_encode)
size_t str_len;
zend_string *result;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &str, &str_len) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_STRING(str, str_len)
+ ZEND_PARSE_PARAMETERS_END();
+
result = php_base64_encode((unsigned char*)str, str_len);
if (result != NULL) {
RETURN_STR(result);
@@ -234,9 +235,12 @@ PHP_FUNCTION(base64_decode)
size_t str_len;
zend_string *result;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|b", &str, &str_len, &strict)
== FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 2)
+ Z_PARAM_STRING(str, str_len)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_BOOL(strict)
+ ZEND_PARSE_PARAMETERS_END();
+
result = php_base64_decode_ex((unsigned char*)str, str_len, strict);
if (result != NULL) {
RETURN_STR(result);
diff --git a/ext/standard/filestat.c b/ext/standard/filestat.c
index 47e7d63..05df801 100644
--- a/ext/standard/filestat.c
+++ b/ext/standard/filestat.c
@@ -186,9 +186,9 @@ PHP_FUNCTION(disk_total_space)
char *path;
size_t path_len;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "p", &path, &path_len) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_PATH(path, path_len)
+ ZEND_PARSE_PARAMETERS_END();
if (php_check_open_basedir(path)) {
RETURN_FALSE;
@@ -279,9 +279,9 @@ PHP_FUNCTION(disk_free_space)
char *path;
size_t path_len;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "p", &path, &path_len) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_PATH(path, path_len)
+ ZEND_PARSE_PARAMETERS_END();
if (php_check_open_basedir(path)) {
RETURN_FALSE;
@@ -337,9 +337,10 @@ static void php_do_chgrp(INTERNAL_FUNCTION_PARAMETERS, int do_lchgrp) /* {{{ */
#endif
php_stream_wrapper *wrapper;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "pz/", &filename, &filename_len,
&group) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 2)
+ Z_PARAM_PATH(filename, filename_len)
+ Z_PARAM_ZVAL_DEREF_EX(group, 0, 1)
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
wrapper = php_stream_locate_url_wrapper(filename, NULL, 0);
if(wrapper != &php_plain_files_wrapper || strncasecmp("file://", filename, 7) == 0)
{
@@ -472,9 +473,10 @@ static void php_do_chown(INTERNAL_FUNCTION_PARAMETERS, int do_lchown) /* {{{ */
#endif
php_stream_wrapper *wrapper;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "pz/", &filename, &filename_len,
&user) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 2)
+ Z_PARAM_PATH(filename, filename_len)
+ Z_PARAM_ZVAL_DEREF_EX(user, 0, 1)
+ ZEND_PARSE_PARAMETERS_END();
wrapper = php_stream_locate_url_wrapper(filename, NULL, 0);
if(wrapper != &php_plain_files_wrapper || strncasecmp("file://", filename, 7) == 0)
{
@@ -578,9 +580,10 @@ PHP_FUNCTION(chmod)
mode_t imode;
php_stream_wrapper *wrapper;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "pl", &filename, &filename_len,
&mode) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 2)
+ Z_PARAM_PATH(filename, filename_len)
+ Z_PARAM_LONG(mode)
+ ZEND_PARSE_PARAMETERS_END();
wrapper = php_stream_locate_url_wrapper(filename, NULL, 0);
if(wrapper != &php_plain_files_wrapper || strncasecmp("file://", filename, 7) == 0)
{
@@ -626,9 +629,12 @@ PHP_FUNCTION(touch)
struct utimbuf *newtime = &newtimebuf;
php_stream_wrapper *wrapper;
- if (zend_parse_parameters(argc, "p|ll", &filename, &filename_len, &filetime,
&fileatime) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 3)
+ Z_PARAM_PATH(filename, filename_len)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(filetime)
+ Z_PARAM_LONG(fileatime)
+ ZEND_PARSE_PARAMETERS_END();
if (!filename_len) {
RETURN_FALSE;
@@ -736,9 +742,11 @@ PHP_FUNCTION(clearstatcache)
char *filename = NULL;
size_t filename_len = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "|bp", &clear_realpath_cache,
&filename, &filename_len) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(0, 2)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_BOOL(clear_realpath_cache)
+ Z_PARAM_PATH(filename, filename_len)
+ ZEND_PARSE_PARAMETERS_END();
php_clear_stat_cache(clear_realpath_cache, filename, filename_len);
}
diff --git a/ext/standard/formatted_print.c b/ext/standard/formatted_print.c
index 3e3d59c..9058f31 100644
--- a/ext/standard/formatted_print.c
+++ b/ext/standard/formatted_print.c
@@ -727,9 +727,10 @@ PHP_FUNCTION(fprintf)
WRONG_PARAM_COUNT;
}
- if (zend_parse_parameters(1, "r", &arg1) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(1, -1)
+ Z_PARAM_RESOURCE(arg1)
+ /* php_formatted_print does its own zpp for extra args */
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
php_stream_from_zval(stream, arg1);
@@ -756,9 +757,10 @@ PHP_FUNCTION(vfprintf)
WRONG_PARAM_COUNT;
}
- if (zend_parse_parameters(1, "r", &arg1) == FAILURE) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_START(1, -1)
+ Z_PARAM_RESOURCE(arg1)
+ /* php_formatted_print does its own zpp for extra args */
+ ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
php_stream_from_zval(stream, arg1);
diff --git a/ext/standard/quot_print.c b/ext/standard/quot_print.c
index be352cb..909470f 100644
--- a/ext/standard/quot_print..c
+++ b/ext/standard/quot_print.c
@@ -206,9 +206,9 @@ PHP_FUNCTION(quoted_printable_decode)
zend_string *str_out;
size_t i = 0, j = 0, k;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &arg1) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_STR(arg1)
+ ZEND_PARSE_PARAMETERS_END();
if (ZSTR_LEN(arg1) == 0) {
/* shortcut */
@@ -267,9 +267,9 @@ PHP_FUNCTION(quoted_printable_encode)
zend_string *str;
zend_string *new_str;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &str) != SUCCESS) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_STR(str)
+ ZEND_PARSE_PARAMETERS_END();
if (!ZSTR_LEN(str)) {
RETURN_EMPTY_STRING();
diff --git a/ext/standard/syslog.c b/ext/standard/syslog.c
index 38605eb..91162d3 100644
--- a/ext/standard/syslog.c
+++ b/ext/standard/syslog.c
@@ -138,10 +138,12 @@ PHP_FUNCTION(openlog)
zend_long option, facility;
size_t ident_len;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "sll", &ident,
- &ident_len, &option, &facility) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(3, 3)
+ Z_PARAM_STRING(ident, ident_len)
+ Z_PARAM_LONG(option)
+ Z_PARAM_LONG(facility)
+ ZEND_PARSE_PARAMETERS_END();
+
if (BG(syslog_device)) {
free(BG(syslog_device));
}
@@ -179,10 +181,10 @@ PHP_FUNCTION(syslog)
char *message;
size_t message_len;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "ls", &priority,
- &message, &message_len) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 2)
+ Z_PARAM_LONG(priority)
+ Z_PARAM_STRING(message, message_len)
+ ZEND_PARSE_PARAMETERS_END();
php_syslog(priority, "%s", message);
RETURN_TRUE;