Created
December 27, 2013 01:32
-
-
Save realityking/8141213 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* {{{ proto void register_shutdown_function(callback function) U | |
| Register a user-level function to be called on request termination */ | |
| PHP_FUNCTION(register_shutdown_function) | |
| { | |
| php_shutdown_function_entry shutdown_function_entry; | |
| int i; | |
| zval ***args = NULL; | |
| if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "+", &args, &shutdown_function_entry.arg_count) == FAILURE) { | |
| return; | |
| } | |
| /* shutdown_function_entry.arguments = (zval **) safe_emalloc(sizeof(zval *), shutdown_function_entry.arg_count, 0); | |
| if (zend_get_parameters_array(ht, shutdown_function_entry.arg_count, shutdown_function_entry.arguments) == FAILURE) { | |
| efree(shutdown_function_entry.arguments); | |
| RETURN_FALSE; | |
| } */ | |
| shutdown_function_entry.arguments = *args; | |
| 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); | |
| } | |
| for (i = 0; i < shutdown_function_entry.arg_count; i++) { | |
| Z_ADDREF_P(shutdown_function_entry.arguments[i]); | |
| } | |
| zend_hash_next_index_insert(BG(user_shutdown_function_names), &shutdown_function_entry, sizeof(php_shutdown_function_entry), NULL); | |
| } | |
| /* }}} */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment