diff options
Diffstat (limited to 'ext/standard/basic_functions.c')
-rw-r--r-- | ext/standard/basic_functions.c | 37 |
1 files changed, 32 insertions, 5 deletions
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index e793e3ca93..b8b53ddea3 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -118,11 +118,6 @@ PHPAPI php_basic_globals basic_globals; static zend_class_entry *incomplete_class_entry = NULL; -typedef struct _php_shutdown_function_entry { - zval **arguments; - int arg_count; -} php_shutdown_function_entry; - typedef struct _user_tick_function_entry { zval **arguments; int arg_count; @@ -5078,6 +5073,38 @@ PHP_FUNCTION(register_shutdown_function) } /* }}} */ +PHPAPI zend_bool register_user_shutdown_function(char *function_name, php_shutdown_function_entry *shutdown_function_entry) /* {{{ */ +{ + if (!BG(user_shutdown_function_names)) { + ALLOC_HASHTABLE(BG(user_shutdown_function_names)); + zend_hash_init(BG(user_shutdown_function_names), 0, NULL, (void (*)(void *)) user_shutdown_function_dtor, 0); + } + + return zend_hash_update(BG(user_shutdown_function_names), function_name, sizeof(function_name), shutdown_function_entry, sizeof(php_shutdown_function_entry), NULL) != FAILURE; +} +/* }}} */ + +PHPAPI zend_bool remove_user_shutdown_function(char *function_name) /* {{{ */ +{ + if (BG(user_shutdown_function_names)) { + return zend_hash_del_key_or_index(BG(user_shutdown_function_names), function_name, sizeof(function_name), 0, HASH_DEL_KEY) != FAILURE; + } + + return 0; +} +/* }}} */ + +PHPAPI zend_bool append_user_shutdown_function(php_shutdown_function_entry shutdown_function_entry) /* {{{ */ +{ + if (!BG(user_shutdown_function_names)) { + ALLOC_HASHTABLE(BG(user_shutdown_function_names)); + zend_hash_init(BG(user_shutdown_function_names), 0, NULL, (void (*)(void *)) user_shutdown_function_dtor, 0); + } + + return zend_hash_next_index_insert(BG(user_shutdown_function_names), &shutdown_function_entry, sizeof(php_shutdown_function_entry), NULL) != FAILURE; +} +/* }}} */ + ZEND_API void php_get_highlight_struct(zend_syntax_highlighter_ini *syntax_highlighter_ini) /* {{{ */ { syntax_highlighter_ini->highlight_comment = INI_STR("highlight.comment"); |