Skip to content

Commit db4561b

Browse files
committed
Introduced "zif_handler" type (zif = zend internal function).
1 parent ace9fe5 commit db4561b

File tree

8 files changed

+62
-59
lines changed

8 files changed

+62
-59
lines changed

Zend/zend_API.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ BEGIN_EXTERN_C()
3535

3636
typedef struct _zend_function_entry {
3737
const char *fname;
38-
void (*handler)(INTERNAL_FUNCTION_PARAMETERS);
38+
zif_handler handler;
3939
const struct _zend_internal_arg_info *arg_info;
4040
uint32_t num_args;
4141
uint32_t flags;

Zend/zend_closures.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ typedef struct _zend_closure {
3939
zend_function func;
4040
zval this_ptr;
4141
zend_class_entry *called_scope;
42-
void (*orig_internal_handler)(INTERNAL_FUNCTION_PARAMETERS);
42+
zif_handler orig_internal_handler;
4343
} zend_closure;
4444

4545
/* non-static since it needs to be referenced */
@@ -235,7 +235,7 @@ ZEND_METHOD(Closure, bind)
235235
}
236236
/* }}} */
237237

238-
static void zend_closure_call_magic(INTERNAL_FUNCTION_PARAMETERS) /* {{{ */ {
238+
static ZEND_NAMED_FUNCTION(zend_closure_call_magic) /* {{{ */ {
239239
zend_fcall_info fci;
240240
zend_fcall_info_cache fcc;
241241
zval params[2];
@@ -628,7 +628,7 @@ void zend_register_closure_ce(void) /* {{{ */
628628
}
629629
/* }}} */
630630

631-
static void zend_closure_internal_handler(INTERNAL_FUNCTION_PARAMETERS) /* {{{ */
631+
static ZEND_NAMED_FUNCTION(zend_closure_internal_handler) /* {{{ */
632632
{
633633
zend_closure *closure = (zend_closure*)EX(func)->common.prototype;
634634
closure->orig_internal_handler(INTERNAL_FUNCTION_PARAM_PASSTHRU);

Zend/zend_compile.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,9 @@ struct _zend_op_array {
409409
#define ZEND_RETURN_VALUE 0
410410
#define ZEND_RETURN_REFERENCE 1
411411

412+
/* zend_internal_function_handler */
413+
typedef void (*zif_handler)(INTERNAL_FUNCTION_PARAMETERS);
414+
412415
typedef struct _zend_internal_function {
413416
/* Common elements */
414417
zend_uchar type;
@@ -422,7 +425,7 @@ typedef struct _zend_internal_function {
422425
zend_internal_arg_info *arg_info;
423426
/* END of common elements */
424427

425-
void (*handler)(INTERNAL_FUNCTION_PARAMETERS);
428+
zif_handler handler;
426429
struct _zend_module_entry *module;
427430
void *reserved[ZEND_MAX_RESERVED_RESOURCES];
428431
} zend_internal_function;

ext/opcache/ZendAccelerator.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ zend_bool fallback_process = 0; /* process uses file cache fallback */
115115
static zend_op_array *(*accelerator_orig_compile_file)(zend_file_handle *file_handle, int type);
116116
static int (*accelerator_orig_zend_stream_open_function)(const char *filename, zend_file_handle *handle );
117117
static zend_string *(*accelerator_orig_zend_resolve_path)(const char *filename, int filename_len);
118-
static void (*orig_chdir)(INTERNAL_FUNCTION_PARAMETERS) = NULL;
118+
static zif_handler orig_chdir = NULL;
119119
static ZEND_INI_MH((*orig_include_path_on_modify)) = NULL;
120120

121121
static void accel_gen_system_id(void);

ext/opcache/zend_accelerator_module.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@
3737
#define MAX_ACCEL_FILES 1000000
3838
#define TOKENTOSTR(X) #X
3939

40-
static void (*orig_file_exists)(INTERNAL_FUNCTION_PARAMETERS) = NULL;
41-
static void (*orig_is_file)(INTERNAL_FUNCTION_PARAMETERS) = NULL;
42-
static void (*orig_is_readable)(INTERNAL_FUNCTION_PARAMETERS) = NULL;
40+
static zif_handler orig_file_exists = NULL;
41+
static zif_handler orig_is_file = NULL;
42+
static zif_handler orig_is_readable = NULL;
4343

4444
ZEND_BEGIN_ARG_INFO(arginfo_opcache_none, 0)
4545
ZEND_END_ARG_INFO()
@@ -365,7 +365,7 @@ static int accel_file_in_cache(INTERNAL_FUNCTION_PARAMETERS)
365365
return filename_is_in_cache(Z_STR(zfilename));
366366
}
367367

368-
static void accel_file_exists(INTERNAL_FUNCTION_PARAMETERS)
368+
static ZEND_NAMED_FUNCTION(accel_file_exists)
369369
{
370370
if (accel_file_in_cache(INTERNAL_FUNCTION_PARAM_PASSTHRU)) {
371371
RETURN_TRUE;
@@ -374,7 +374,7 @@ static void accel_file_exists(INTERNAL_FUNCTION_PARAMETERS)
374374
}
375375
}
376376

377-
static void accel_is_file(INTERNAL_FUNCTION_PARAMETERS)
377+
static ZEND_NAMED_FUNCTION(accel_is_file)
378378
{
379379
if (accel_file_in_cache(INTERNAL_FUNCTION_PARAM_PASSTHRU)) {
380380
RETURN_TRUE;
@@ -383,7 +383,7 @@ static void accel_is_file(INTERNAL_FUNCTION_PARAMETERS)
383383
}
384384
}
385385

386-
static void accel_is_readable(INTERNAL_FUNCTION_PARAMETERS)
386+
static ZEND_NAMED_FUNCTION(accel_is_readable)
387387
{
388388
if (accel_file_in_cache(INTERNAL_FUNCTION_PARAM_PASSTHRU)) {
389389
RETURN_TRUE;

ext/phar/func_interceptors.c

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,7 @@ static void phar_fancy_stat(zend_stat_t *stat_sb, int type, zval *return_value)
585585
}
586586
/* }}} */
587587

588-
static void phar_file_stat(const char *filename, size_t filename_length, int type, void (*orig_stat_func)(INTERNAL_FUNCTION_PARAMETERS), INTERNAL_FUNCTION_PARAMETERS) /* {{{ */
588+
static void phar_file_stat(const char *filename, size_t filename_length, int type, zif_handler orig_stat_func, INTERNAL_FUNCTION_PARAMETERS) /* {{{ */
589589
{
590590
if (!filename_length) {
591591
RETURN_FALSE;
@@ -759,7 +759,7 @@ static void phar_file_stat(const char *filename, size_t filename_length, int typ
759759
/* }}} */
760760

761761
#define PharFileFunction(fname, funcnum, orig) \
762-
void fname(INTERNAL_FUNCTION_PARAMETERS) { \
762+
ZEND_NAMED_FUNCTION(fname) { \
763763
if (!PHAR_G(intercepted)) { \
764764
PHAR_G(orig)(INTERNAL_FUNCTION_PARAM_PASSTHRU); \
765765
} else { \
@@ -1080,28 +1080,28 @@ void phar_intercept_functions_shutdown(void)
10801080
/* }}} */
10811081

10821082
static struct _phar_orig_functions {
1083-
void (*orig_fopen)(INTERNAL_FUNCTION_PARAMETERS);
1084-
void (*orig_file_get_contents)(INTERNAL_FUNCTION_PARAMETERS);
1085-
void (*orig_is_file)(INTERNAL_FUNCTION_PARAMETERS);
1086-
void (*orig_is_link)(INTERNAL_FUNCTION_PARAMETERS);
1087-
void (*orig_is_dir)(INTERNAL_FUNCTION_PARAMETERS);
1088-
void (*orig_opendir)(INTERNAL_FUNCTION_PARAMETERS);
1089-
void (*orig_file_exists)(INTERNAL_FUNCTION_PARAMETERS);
1090-
void (*orig_fileperms)(INTERNAL_FUNCTION_PARAMETERS);
1091-
void (*orig_fileinode)(INTERNAL_FUNCTION_PARAMETERS);
1092-
void (*orig_filesize)(INTERNAL_FUNCTION_PARAMETERS);
1093-
void (*orig_fileowner)(INTERNAL_FUNCTION_PARAMETERS);
1094-
void (*orig_filegroup)(INTERNAL_FUNCTION_PARAMETERS);
1095-
void (*orig_fileatime)(INTERNAL_FUNCTION_PARAMETERS);
1096-
void (*orig_filemtime)(INTERNAL_FUNCTION_PARAMETERS);
1097-
void (*orig_filectime)(INTERNAL_FUNCTION_PARAMETERS);
1098-
void (*orig_filetype)(INTERNAL_FUNCTION_PARAMETERS);
1099-
void (*orig_is_writable)(INTERNAL_FUNCTION_PARAMETERS);
1100-
void (*orig_is_readable)(INTERNAL_FUNCTION_PARAMETERS);
1101-
void (*orig_is_executable)(INTERNAL_FUNCTION_PARAMETERS);
1102-
void (*orig_lstat)(INTERNAL_FUNCTION_PARAMETERS);
1103-
void (*orig_readfile)(INTERNAL_FUNCTION_PARAMETERS);
1104-
void (*orig_stat)(INTERNAL_FUNCTION_PARAMETERS);
1083+
zif_handler orig_fopen;
1084+
zif_handler orig_file_get_contents;
1085+
zif_handler orig_is_file;
1086+
zif_handler orig_is_link;
1087+
zif_handler orig_is_dir;
1088+
zif_handler orig_opendir;
1089+
zif_handler orig_file_exists;
1090+
zif_handler orig_fileperms;
1091+
zif_handler orig_fileinode;
1092+
zif_handler orig_filesize;
1093+
zif_handler orig_fileowner;
1094+
zif_handler orig_filegroup;
1095+
zif_handler orig_fileatime;
1096+
zif_handler orig_filemtime;
1097+
zif_handler orig_filectime;
1098+
zif_handler orig_filetype;
1099+
zif_handler orig_is_writable;
1100+
zif_handler orig_is_readable;
1101+
zif_handler orig_is_executable;
1102+
zif_handler orig_lstat;
1103+
zif_handler orig_readfile;
1104+
zif_handler orig_stat;
11051105
} phar_orig_functions = {NULL};
11061106

11071107
void phar_save_orig_functions(void) /* {{{ */

ext/phar/phar_internal.h

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -155,28 +155,28 @@ ZEND_BEGIN_MODULE_GLOBALS(phar)
155155
int require_hash;
156156
int request_done;
157157
int request_ends;
158-
void (*orig_fopen)(INTERNAL_FUNCTION_PARAMETERS);
159-
void (*orig_file_get_contents)(INTERNAL_FUNCTION_PARAMETERS);
160-
void (*orig_is_file)(INTERNAL_FUNCTION_PARAMETERS);
161-
void (*orig_is_link)(INTERNAL_FUNCTION_PARAMETERS);
162-
void (*orig_is_dir)(INTERNAL_FUNCTION_PARAMETERS);
163-
void (*orig_opendir)(INTERNAL_FUNCTION_PARAMETERS);
164-
void (*orig_file_exists)(INTERNAL_FUNCTION_PARAMETERS);
165-
void (*orig_fileperms)(INTERNAL_FUNCTION_PARAMETERS);
166-
void (*orig_fileinode)(INTERNAL_FUNCTION_PARAMETERS);
167-
void (*orig_filesize)(INTERNAL_FUNCTION_PARAMETERS);
168-
void (*orig_fileowner)(INTERNAL_FUNCTION_PARAMETERS);
169-
void (*orig_filegroup)(INTERNAL_FUNCTION_PARAMETERS);
170-
void (*orig_fileatime)(INTERNAL_FUNCTION_PARAMETERS);
171-
void (*orig_filemtime)(INTERNAL_FUNCTION_PARAMETERS);
172-
void (*orig_filectime)(INTERNAL_FUNCTION_PARAMETERS);
173-
void (*orig_filetype)(INTERNAL_FUNCTION_PARAMETERS);
174-
void (*orig_is_writable)(INTERNAL_FUNCTION_PARAMETERS);
175-
void (*orig_is_readable)(INTERNAL_FUNCTION_PARAMETERS);
176-
void (*orig_is_executable)(INTERNAL_FUNCTION_PARAMETERS);
177-
void (*orig_lstat)(INTERNAL_FUNCTION_PARAMETERS);
178-
void (*orig_readfile)(INTERNAL_FUNCTION_PARAMETERS);
179-
void (*orig_stat)(INTERNAL_FUNCTION_PARAMETERS);
158+
zif_handler orig_fopen;
159+
zif_handler orig_file_get_contents;
160+
zif_handler orig_is_file;
161+
zif_handler orig_is_link;
162+
zif_handler orig_is_dir;
163+
zif_handler orig_opendir;
164+
zif_handler orig_file_exists;
165+
zif_handler orig_fileperms;
166+
zif_handler orig_fileinode;
167+
zif_handler orig_filesize;
168+
zif_handler orig_fileowner;
169+
zif_handler orig_filegroup;
170+
zif_handler orig_fileatime;
171+
zif_handler orig_filemtime;
172+
zif_handler orig_filectime;
173+
zif_handler orig_filetype;
174+
zif_handler orig_is_writable;
175+
zif_handler orig_is_readable;
176+
zif_handler orig_is_executable;
177+
zif_handler orig_lstat;
178+
zif_handler orig_readfile;
179+
zif_handler orig_stat;
180180
/* used for includes with . in them inside front controller */
181181
char* cwd;
182182
int cwd_len;

ext/standard/filestat.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -996,7 +996,7 @@ PHPAPI void php_stat(const char *filename, size_t filename_length, int type, zva
996996
/* another quickie macro to make defining similar functions easier */
997997
/* {{{ FileFunction(name, funcnum) */
998998
#define FileFunction(name, funcnum) \
999-
void name(INTERNAL_FUNCTION_PARAMETERS) { \
999+
ZEND_NAMED_FUNCTION(name) { \
10001000
char *filename; \
10011001
size_t filename_len; \
10021002
\

0 commit comments

Comments
 (0)