]> granicus.if.org Git - php/commitdiff
Introduced "zif_handler" type (zif = zend internal function).
authorDmitry Stogov <dmitry@zend.com>
Thu, 8 Jun 2017 13:52:39 +0000 (16:52 +0300)
committerDmitry Stogov <dmitry@zend.com>
Thu, 8 Jun 2017 13:52:39 +0000 (16:52 +0300)
Zend/zend_API.h
Zend/zend_closures.c
Zend/zend_compile.h
ext/opcache/ZendAccelerator.c
ext/opcache/zend_accelerator_module.c
ext/phar/func_interceptors.c
ext/phar/phar_internal.h
ext/standard/filestat.c

index 69f4d56b6285ca22523257d90c75dc159c50687c..df04be1fbe38a17c23097a5223c5f35cc656a848 100644 (file)
@@ -35,7 +35,7 @@ BEGIN_EXTERN_C()
 
 typedef struct _zend_function_entry {
        const char *fname;
-       void (*handler)(INTERNAL_FUNCTION_PARAMETERS);
+       zif_handler handler;
        const struct _zend_internal_arg_info *arg_info;
        uint32_t num_args;
        uint32_t flags;
index 6e7b30361f830217e8b0146f3dd3a82ce34403c9..2dd468d9545553d88add753ca68cb2a6c7a45177 100644 (file)
@@ -39,7 +39,7 @@ typedef struct _zend_closure {
        zend_function     func;
        zval              this_ptr;
        zend_class_entry *called_scope;
-       void (*orig_internal_handler)(INTERNAL_FUNCTION_PARAMETERS);
+       zif_handler       orig_internal_handler;
 } zend_closure;
 
 /* non-static since it needs to be referenced */
@@ -235,7 +235,7 @@ ZEND_METHOD(Closure, bind)
 }
 /* }}} */
 
-static void zend_closure_call_magic(INTERNAL_FUNCTION_PARAMETERS) /* {{{ */ {
+static ZEND_NAMED_FUNCTION(zend_closure_call_magic) /* {{{ */ {
        zend_fcall_info fci;
        zend_fcall_info_cache fcc;
        zval params[2];
@@ -628,7 +628,7 @@ void zend_register_closure_ce(void) /* {{{ */
 }
 /* }}} */
 
-static void zend_closure_internal_handler(INTERNAL_FUNCTION_PARAMETERS) /* {{{ */
+static ZEND_NAMED_FUNCTION(zend_closure_internal_handler) /* {{{ */
 {
        zend_closure *closure = (zend_closure*)EX(func)->common.prototype;
        closure->orig_internal_handler(INTERNAL_FUNCTION_PARAM_PASSTHRU);
index 44035a67ff134f19f7a45f63cff3dc1f7b98c08d..4264232bc426d7b72416894aee925bfb5272957f 100644 (file)
@@ -409,6 +409,9 @@ struct _zend_op_array {
 #define ZEND_RETURN_VALUE                              0
 #define ZEND_RETURN_REFERENCE                  1
 
+/* zend_internal_function_handler */
+typedef void (*zif_handler)(INTERNAL_FUNCTION_PARAMETERS);
+
 typedef struct _zend_internal_function {
        /* Common elements */
        zend_uchar type;
@@ -422,7 +425,7 @@ typedef struct _zend_internal_function {
        zend_internal_arg_info *arg_info;
        /* END of common elements */
 
-       void (*handler)(INTERNAL_FUNCTION_PARAMETERS);
+       zif_handler handler;
        struct _zend_module_entry *module;
        void *reserved[ZEND_MAX_RESERVED_RESOURCES];
 } zend_internal_function;
index 0d81b89455a668ce2344a0e09c0fc96f73489a66..c2ff2676062f7f485b926df836b1e8940db82527 100644 (file)
@@ -115,7 +115,7 @@ zend_bool fallback_process = 0; /* process uses file cache fallback */
 static zend_op_array *(*accelerator_orig_compile_file)(zend_file_handle *file_handle, int type);
 static int (*accelerator_orig_zend_stream_open_function)(const char *filename, zend_file_handle *handle );
 static zend_string *(*accelerator_orig_zend_resolve_path)(const char *filename, int filename_len);
-static void (*orig_chdir)(INTERNAL_FUNCTION_PARAMETERS) = NULL;
+static zif_handler orig_chdir = NULL;
 static ZEND_INI_MH((*orig_include_path_on_modify)) = NULL;
 
 static void accel_gen_system_id(void);
index c583f679b2f7ac01c13d2a64d4561280112772c9..6f76851455360b12446129fece6586abd30a79f5 100644 (file)
@@ -37,9 +37,9 @@
 #define MAX_ACCEL_FILES 1000000
 #define TOKENTOSTR(X) #X
 
-static void (*orig_file_exists)(INTERNAL_FUNCTION_PARAMETERS) = NULL;
-static void (*orig_is_file)(INTERNAL_FUNCTION_PARAMETERS) = NULL;
-static void (*orig_is_readable)(INTERNAL_FUNCTION_PARAMETERS) = NULL;
+static zif_handler orig_file_exists = NULL;
+static zif_handler orig_is_file = NULL;
+static zif_handler orig_is_readable = NULL;
 
 ZEND_BEGIN_ARG_INFO(arginfo_opcache_none, 0)
 ZEND_END_ARG_INFO()
@@ -365,7 +365,7 @@ static int accel_file_in_cache(INTERNAL_FUNCTION_PARAMETERS)
        return filename_is_in_cache(Z_STR(zfilename));
 }
 
-static void accel_file_exists(INTERNAL_FUNCTION_PARAMETERS)
+static ZEND_NAMED_FUNCTION(accel_file_exists)
 {
        if (accel_file_in_cache(INTERNAL_FUNCTION_PARAM_PASSTHRU)) {
                RETURN_TRUE;
@@ -374,7 +374,7 @@ static void accel_file_exists(INTERNAL_FUNCTION_PARAMETERS)
        }
 }
 
-static void accel_is_file(INTERNAL_FUNCTION_PARAMETERS)
+static ZEND_NAMED_FUNCTION(accel_is_file)
 {
        if (accel_file_in_cache(INTERNAL_FUNCTION_PARAM_PASSTHRU)) {
                RETURN_TRUE;
@@ -383,7 +383,7 @@ static void accel_is_file(INTERNAL_FUNCTION_PARAMETERS)
        }
 }
 
-static void accel_is_readable(INTERNAL_FUNCTION_PARAMETERS)
+static ZEND_NAMED_FUNCTION(accel_is_readable)
 {
        if (accel_file_in_cache(INTERNAL_FUNCTION_PARAM_PASSTHRU)) {
                RETURN_TRUE;
index 20a827e1d9a833c041474fe5488674a5e2ed2324..eb05d4ce2d48aa0888722ed432fe1d4e0823ad68 100644 (file)
@@ -585,7 +585,7 @@ static void phar_fancy_stat(zend_stat_t *stat_sb, int type, zval *return_value)
 }
 /* }}} */
 
-static void phar_file_stat(const char *filename, size_t filename_length, int type, void (*orig_stat_func)(INTERNAL_FUNCTION_PARAMETERS), INTERNAL_FUNCTION_PARAMETERS) /* {{{ */
+static void phar_file_stat(const char *filename, size_t filename_length, int type, zif_handler orig_stat_func, INTERNAL_FUNCTION_PARAMETERS) /* {{{ */
 {
        if (!filename_length) {
                RETURN_FALSE;
@@ -759,7 +759,7 @@ skip_phar:
 /* }}} */
 
 #define PharFileFunction(fname, funcnum, orig) \
-void fname(INTERNAL_FUNCTION_PARAMETERS) { \
+ZEND_NAMED_FUNCTION(fname) { \
        if (!PHAR_G(intercepted)) { \
                PHAR_G(orig)(INTERNAL_FUNCTION_PARAM_PASSTHRU); \
        } else { \
@@ -1080,28 +1080,28 @@ void phar_intercept_functions_shutdown(void)
 /* }}} */
 
 static struct _phar_orig_functions {
-       void        (*orig_fopen)(INTERNAL_FUNCTION_PARAMETERS);
-       void        (*orig_file_get_contents)(INTERNAL_FUNCTION_PARAMETERS);
-       void        (*orig_is_file)(INTERNAL_FUNCTION_PARAMETERS);
-       void        (*orig_is_link)(INTERNAL_FUNCTION_PARAMETERS);
-       void        (*orig_is_dir)(INTERNAL_FUNCTION_PARAMETERS);
-       void        (*orig_opendir)(INTERNAL_FUNCTION_PARAMETERS);
-       void        (*orig_file_exists)(INTERNAL_FUNCTION_PARAMETERS);
-       void        (*orig_fileperms)(INTERNAL_FUNCTION_PARAMETERS);
-       void        (*orig_fileinode)(INTERNAL_FUNCTION_PARAMETERS);
-       void        (*orig_filesize)(INTERNAL_FUNCTION_PARAMETERS);
-       void        (*orig_fileowner)(INTERNAL_FUNCTION_PARAMETERS);
-       void        (*orig_filegroup)(INTERNAL_FUNCTION_PARAMETERS);
-       void        (*orig_fileatime)(INTERNAL_FUNCTION_PARAMETERS);
-       void        (*orig_filemtime)(INTERNAL_FUNCTION_PARAMETERS);
-       void        (*orig_filectime)(INTERNAL_FUNCTION_PARAMETERS);
-       void        (*orig_filetype)(INTERNAL_FUNCTION_PARAMETERS);
-       void        (*orig_is_writable)(INTERNAL_FUNCTION_PARAMETERS);
-       void        (*orig_is_readable)(INTERNAL_FUNCTION_PARAMETERS);
-       void        (*orig_is_executable)(INTERNAL_FUNCTION_PARAMETERS);
-       void        (*orig_lstat)(INTERNAL_FUNCTION_PARAMETERS);
-       void        (*orig_readfile)(INTERNAL_FUNCTION_PARAMETERS);
-       void        (*orig_stat)(INTERNAL_FUNCTION_PARAMETERS);
+       zif_handler orig_fopen;
+       zif_handler orig_file_get_contents;
+       zif_handler orig_is_file;
+       zif_handler orig_is_link;
+       zif_handler orig_is_dir;
+       zif_handler orig_opendir;
+       zif_handler orig_file_exists;
+       zif_handler orig_fileperms;
+       zif_handler orig_fileinode;
+       zif_handler orig_filesize;
+       zif_handler orig_fileowner;
+       zif_handler orig_filegroup;
+       zif_handler orig_fileatime;
+       zif_handler orig_filemtime;
+       zif_handler orig_filectime;
+       zif_handler orig_filetype;
+       zif_handler orig_is_writable;
+       zif_handler orig_is_readable;
+       zif_handler orig_is_executable;
+       zif_handler orig_lstat;
+       zif_handler orig_readfile;
+       zif_handler orig_stat;
 } phar_orig_functions = {NULL};
 
 void phar_save_orig_functions(void) /* {{{ */
index e06550d2664b52615b09f75e55eca0b0d075e68c..c08c88de19ea80d960655eb8cda000c5ea52117a 100644 (file)
@@ -155,28 +155,28 @@ ZEND_BEGIN_MODULE_GLOBALS(phar)
        int         require_hash;
        int         request_done;
        int         request_ends;
-       void        (*orig_fopen)(INTERNAL_FUNCTION_PARAMETERS);
-       void        (*orig_file_get_contents)(INTERNAL_FUNCTION_PARAMETERS);
-       void        (*orig_is_file)(INTERNAL_FUNCTION_PARAMETERS);
-       void        (*orig_is_link)(INTERNAL_FUNCTION_PARAMETERS);
-       void        (*orig_is_dir)(INTERNAL_FUNCTION_PARAMETERS);
-       void        (*orig_opendir)(INTERNAL_FUNCTION_PARAMETERS);
-       void        (*orig_file_exists)(INTERNAL_FUNCTION_PARAMETERS);
-       void        (*orig_fileperms)(INTERNAL_FUNCTION_PARAMETERS);
-       void        (*orig_fileinode)(INTERNAL_FUNCTION_PARAMETERS);
-       void        (*orig_filesize)(INTERNAL_FUNCTION_PARAMETERS);
-       void        (*orig_fileowner)(INTERNAL_FUNCTION_PARAMETERS);
-       void        (*orig_filegroup)(INTERNAL_FUNCTION_PARAMETERS);
-       void        (*orig_fileatime)(INTERNAL_FUNCTION_PARAMETERS);
-       void        (*orig_filemtime)(INTERNAL_FUNCTION_PARAMETERS);
-       void        (*orig_filectime)(INTERNAL_FUNCTION_PARAMETERS);
-       void        (*orig_filetype)(INTERNAL_FUNCTION_PARAMETERS);
-       void        (*orig_is_writable)(INTERNAL_FUNCTION_PARAMETERS);
-       void        (*orig_is_readable)(INTERNAL_FUNCTION_PARAMETERS);
-       void        (*orig_is_executable)(INTERNAL_FUNCTION_PARAMETERS);
-       void        (*orig_lstat)(INTERNAL_FUNCTION_PARAMETERS);
-       void        (*orig_readfile)(INTERNAL_FUNCTION_PARAMETERS);
-       void        (*orig_stat)(INTERNAL_FUNCTION_PARAMETERS);
+       zif_handler orig_fopen;
+       zif_handler orig_file_get_contents;
+       zif_handler orig_is_file;
+       zif_handler orig_is_link;
+       zif_handler orig_is_dir;
+       zif_handler orig_opendir;
+       zif_handler orig_file_exists;
+       zif_handler orig_fileperms;
+       zif_handler orig_fileinode;
+       zif_handler orig_filesize;
+       zif_handler orig_fileowner;
+       zif_handler orig_filegroup;
+       zif_handler orig_fileatime;
+       zif_handler orig_filemtime;
+       zif_handler orig_filectime;
+       zif_handler orig_filetype;
+       zif_handler orig_is_writable;
+       zif_handler orig_is_readable;
+       zif_handler orig_is_executable;
+       zif_handler orig_lstat;
+       zif_handler orig_readfile;
+       zif_handler orig_stat;
        /* used for includes with . in them inside front controller */
        char*       cwd;
        int         cwd_len;
index dfb1c93490f501e62af24c62e8346845e7edc798..f51892b5102a25fc4e273de21672928fd500336f 100644 (file)
@@ -996,7 +996,7 @@ PHPAPI void php_stat(const char *filename, size_t filename_length, int type, zva
 /* another quickie macro to make defining similar functions easier */
 /* {{{ FileFunction(name, funcnum) */
 #define FileFunction(name, funcnum) \
-void name(INTERNAL_FUNCTION_PARAMETERS) { \
+ZEND_NAMED_FUNCTION(name) { \
        char *filename; \
        size_t filename_len; \
        \