cvs: /php4 main.c php.h

From: Date: Wed, 17 Nov 1999 22:59:00 +0000
Subject: cvs: /php4 main.c php.h
Groups: php.version4 
Request: Send a blank email to php-version4+get-6406@lists.php.net to get a copy of this message
sas Wed Nov 17 17:59:00 1999 EDT Modified files: /php4 main.c php.h Log: Add post request startup handlers. These are called at the end of the request startup function, and can use the initialized structures like the symbol table. Index: php4/main.c diff -u php4/main.c:1.134 php4/main.c:1.135 --- php4/main.c:1.134 Fri Nov 5 12:52:00 1999 +++ php4/main.c Wed Nov 17 17:58:29 1999 @@ -19,7 +19,7 @@ */ -/* $Id: main.c,v 1.134 1999/11/05 17:52:00 rubys Exp $ */ +/* $Id: main.c,v 1.135 1999/11/17 22:58:29 sas Exp $ */ #include <stdio.h> @@ -674,13 +674,41 @@ } } +static void php_start_post_request_startup(void *data) +{ + php_post_request_startup *ptr = (php_post_request_startup *) data; + + ptr->func(ptr->userdata); +} + +static void php_finish_post_request_startup(PLS_D) +{ + zend_llist_apply(&PG(ll_post_request_startup), php_start_post_request_startup); + zend_llist_destroy(&PG(ll_post_request_startup)); +} + +static void php_init_post_request_startup(PLS_D) +{ + zend_llist_init(&PG(ll_post_request_startup), sizeof(php_post_request_startup), NULL, 0); +} + +void php_register_post_request_startup(void (*func)(void *), void *userdata) +{ + php_post_request_startup ptr; + PLS_FETCH(); + ptr.func = func; + ptr.userdata = userdata; + + zend_llist_add_element(&PG(ll_post_request_startup), &ptr); +} int php_request_startup(CLS_D ELS_DC PLS_DC SLS_DC) { global_lock(); php_output_startup(); + php_init_post_request_startup(PLS_C); if (PG(output_buffering)) { php_start_ob_buffering(); @@ -732,6 +760,9 @@ zend_hash_update(&EG(symbol_table), "PHP_AUTH_PW", sizeof("PHP_AUTH_PW"), &auth_password, sizeof(zval *), NULL); } + + php_finish_post_request_startup(PLS_C); + return SUCCESS; } Index: php4/php.h diff -u php4/php.h:1.44 php4/php.h:1.45 --- php4/php.h:1.44 Sun Nov 14 06:05:36 1999 +++ php4/php.h Wed Nov 17 17:58:29 1999 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php.h,v 1.44 1999/11/14 11:05:36 ssb Exp $ */ +/* $Id: php.h,v 1.45 1999/11/17 22:58:29 sas Exp $ */ #ifndef _PHP_H #define _PHP_H @@ -316,6 +316,8 @@ /*from basic functions*/ extern PHPAPI int _php_error_log(int opt_err,char *message,char *opt,char *headers); + +PHPAPI void php_register_post_request_startup(void (*func)(void *), void *userdata); PHPAPI int cfg_get_long(char *varname, long *result); PHPAPI int cfg_get_double(char *varname, double *result);

« previous php.version4 (#6406) next »