Skip to content

Commit e5afe6b

Browse files
committed
Drop useless arg2
1 parent f559c78 commit e5afe6b

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

ext/spl/spl_directory.c

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1901,13 +1901,13 @@ static int spl_filesystem_file_read(spl_filesystem_object *intern, int silent) /
19011901
return SUCCESS;
19021902
} /* }}} */
19031903

1904-
static int spl_filesystem_file_call(spl_filesystem_object *intern, zend_function *func_ptr, int pass_num_args, zval *return_value, zval *arg2) /* {{{ */
1904+
static int spl_filesystem_file_call(spl_filesystem_object *intern, zend_function *func_ptr, int pass_num_args, zval *return_value) /* {{{ */
19051905
{
19061906
zend_fcall_info fci;
19071907
zend_fcall_info_cache fcic;
19081908
zval *zresource_ptr = &intern->u.file.zresource, *params;
19091909
int result;
1910-
int num_args = pass_num_args + (arg2 ? 2 : 1);
1910+
int num_args = pass_num_args + 1;
19111911

19121912
if (Z_ISUNDEF_P(zresource_ptr)) {
19131913
zend_throw_exception_ex(spl_ce_RuntimeException, 0, "Object not initialized");
@@ -1917,11 +1917,7 @@ static int spl_filesystem_file_call(spl_filesystem_object *intern, zend_function
19171917
params = (zval*)safe_emalloc(num_args, sizeof(zval), 0);
19181918
params[0] = *zresource_ptr;
19191919

1920-
if (arg2) {
1921-
params[1] = *arg2;
1922-
}
1923-
1924-
if (zend_get_parameters_array_ex(pass_num_args, params + (arg2 ? 2 : 1)) != SUCCESS) {
1920+
if (zend_get_parameters_array_ex(pass_num_args, params + 1) != SUCCESS) {
19251921
efree(params);
19261922
WRONG_PARAM_COUNT_WITH_RETVAL(FAILURE);
19271923
}
@@ -1948,15 +1944,15 @@ static int spl_filesystem_file_call(spl_filesystem_object *intern, zend_function
19481944
return result;
19491945
} /* }}} */
19501946

1951-
#define FileFunctionCall(func_name, pass_num_args, arg2) /* {{{ */ \
1947+
#define FileFunctionCall(func_name, pass_num_args) /* {{{ */ \
19521948
{ \
19531949
zend_function *func_ptr; \
19541950
func_ptr = (zend_function *)zend_hash_str_find_ptr(EG(function_table), #func_name, sizeof(#func_name) - 1); \
19551951
if (func_ptr == NULL) { \
19561952
zend_throw_exception_ex(spl_ce_RuntimeException, 0, "Internal error, function %s() not found. Please report", #func_name); \
19571953
return; \
19581954
} \
1959-
spl_filesystem_file_call(intern, func_ptr, pass_num_args, return_value, arg2); \
1955+
spl_filesystem_file_call(intern, func_ptr, pass_num_args, return_value); \
19601956
} /* }}} */
19611957

19621958
static int spl_filesystem_file_read_csv(spl_filesystem_object *intern, char delimiter, char enclosure, int escape, zval *return_value) /* {{{ */
@@ -2387,7 +2383,7 @@ PHP_METHOD(SplFileObject, getChildren)
23872383
PHP_METHOD(SplFileObject, func_name) \
23882384
{ \
23892385
spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(ZEND_THIS); \
2390-
FileFunctionCall(func_name, ZEND_NUM_ARGS(), NULL); \
2386+
FileFunctionCall(func_name, ZEND_NUM_ARGS()); \
23912387
}
23922388
/* }}} */
23932389

@@ -2681,7 +2677,7 @@ PHP_METHOD(SplFileObject, fscanf)
26812677
spl_filesystem_file_free_line(intern);
26822678
intern->u.file.current_line_num++;
26832679

2684-
FileFunctionCall(fscanf, ZEND_NUM_ARGS(), NULL);
2680+
FileFunctionCall(fscanf, ZEND_NUM_ARGS());
26852681
}
26862682
/* }}} */
26872683

0 commit comments

Comments
 (0)