Skip to content

Commit 304cccf

Browse files
committed
ext/fileinfo: Replace zend_parse_parameters() with ZEND_PARSE_PARAMETERS macros
1 parent 4188c3e commit 304cccf

1 file changed

Lines changed: 11 additions & 9 deletions

File tree

ext/fileinfo/fileinfo.c

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,11 @@ PHP_FUNCTION(finfo_open)
138138
char resolved_path[MAXPATHLEN];
139139
zend_error_handling zeh;
140140

141-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|lp!", &options, &file, &file_len) == FAILURE) {
142-
RETURN_THROWS();
143-
}
141+
ZEND_PARSE_PARAMETERS_START(0, 2)
142+
Z_PARAM_OPTIONAL
143+
Z_PARAM_LONG(options)
144+
Z_PARAM_PATH_OR_NULL(file, file_len)
145+
ZEND_PARSE_PARAMETERS_END();
144146

145147
if (object) {
146148
zend_replace_error_handling(EH_THROW, NULL, &zeh);
@@ -203,9 +205,9 @@ PHP_FUNCTION(finfo_close)
203205
{
204206
zval *self;
205207

206-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &self, finfo_class_entry) == FAILURE) {
207-
RETURN_THROWS();
208-
}
208+
ZEND_PARSE_PARAMETERS_START(1, 1)
209+
Z_PARAM_OBJECT_OF_CLASS(self, finfo_class_entry)
210+
ZEND_PARSE_PARAMETERS_END();
209211

210212
RETURN_TRUE;
211213
}
@@ -389,9 +391,9 @@ PHP_FUNCTION(mime_content_type)
389391
php_stream *stream = NULL;
390392
struct magic_set *magic = NULL;
391393

392-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &path_or_stream) == FAILURE) {
393-
RETURN_THROWS();
394-
}
394+
ZEND_PARSE_PARAMETERS_START(1, 1)
395+
Z_PARAM_ZVAL(path_or_stream)
396+
ZEND_PARSE_PARAMETERS_END();
395397

396398
switch (Z_TYPE_P(path_or_stream)) {
397399
case IS_STRING:

0 commit comments

Comments
 (0)