cvs: php4 /ext/session mod_files.c mod_user.c php_session.h session.c

From: Date: Wed, 06 Mar 2002 11:49:52 +0000
Subject: cvs: php4 /ext/session mod_files.c mod_user.c php_session.h session.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-9726@lists.php.net to get a copy of this message
sas Wed Mar 6 06:49:52 2002 EDT Modified files: /php4/ext/session mod_files.c mod_user.c php_session.h session.c Log: Merge in session API changes (carry around tsrm context) Now PHP_SESSION_API is defined to the date of the last change, so that externa source-code can handle changes more gracefully. Index: php4/ext/session/mod_files.c diff -u php4/ext/session/mod_files.c:1.71 php4/ext/session/mod_files.c:1.72 --- php4/ext/session/mod_files.c:1.71 Wed Mar 6 04:02:31 2002 +++ php4/ext/session/mod_files.c Wed Mar 6 06:49:51 2002 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: mod_files.c,v 1.71 2002/03/06 09:02:31 sas Exp $ */ +/* $Id: mod_files.c,v 1.72 2002/03/06 11:49:51 sas Exp $ */ #include "php.h" @@ -123,10 +123,9 @@ } } -static void ps_files_open(ps_files *data, const char *key) +static void ps_files_open(ps_files *data, const char *key TSRMLS_DC) { char buf[MAXPATHLEN]; - TSRMLS_FETCH(); if (data->fd < 0 || !data->lastkey || strcmp(key, data->lastkey)) { if (data->lastkey) { @@ -159,7 +158,7 @@ } } -static int ps_files_cleanup_dir(const char *dirname, int maxlifetime) +static int ps_files_cleanup_dir(const char *dirname, int maxlifetime TSRMLS_DC) { DIR *dir; char dentry[sizeof(struct dirent) + MAXPATHLEN]; @@ -169,7 +168,6 @@ time_t now; int nrdels = 0; size_t dirname_len; - TSRMLS_FETCH(); dir = opendir(dirname); if (!dir) { @@ -254,7 +252,7 @@ struct stat sbuf; PS_FILES_DATA; - ps_files_open(data, key); + ps_files_open(data, key TSRMLS_CC); if (data->fd < 0) return FAILURE; @@ -283,7 +281,7 @@ long n; PS_FILES_DATA; - ps_files_open(data, key); + ps_files_open(data, key TSRMLS_CC); if (data->fd < 0) return FAILURE; @@ -314,7 +312,6 @@ { char buf[MAXPATHLEN]; PS_FILES_DATA; - TSRMLS_FETCH(); if (!ps_files_path_create(buf, sizeof(buf), data, key)) return FAILURE; @@ -337,7 +334,7 @@ an external entity (i.e. find -ctime x | xargs rm) */ if (data->dirdepth == 0) - *nrdels = ps_files_cleanup_dir(data->basedir, maxlifetime); + *nrdels = ps_files_cleanup_dir(data->basedir, maxlifetime TSRMLS_CC); return SUCCESS; } Index: php4/ext/session/mod_user.c diff -u php4/ext/session/mod_user.c:1.24 php4/ext/session/mod_user.c:1.25 --- php4/ext/session/mod_user.c:1.24 Wed Mar 6 04:02:31 2002 +++ php4/ext/session/mod_user.c Wed Mar 6 06:49:51 2002 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: mod_user.c,v 1.24 2002/03/06 09:02:31 sas Exp $ */ +/* $Id: mod_user.c,v 1.25 2002/03/06 11:49:51 sas Exp $ */ #include "php.h" #include "php_session.h" @@ -51,11 +51,10 @@ } -static zval *ps_call_handler(zval *func, int argc, zval **argv) +static zval *ps_call_handler(zval *func, int argc, zval **argv TSRMLS_DC) { int i; zval *retval = NULL; - TSRMLS_FETCH(); MAKE_STD_ZVAL(retval); if (call_user_function(EG(function_table), NULL, func, retval, @@ -96,7 +95,7 @@ SESS_ZVAL_STRING(save_path, args[0]); SESS_ZVAL_STRING(session_name, args[1]); - retval = ps_call_handler(PSF(open), 2, args); + retval = ps_call_handler(PSF(open), 2, args TSRMLS_CC); FINISH; } @@ -106,7 +105,7 @@ int i; STDVARS; - retval = ps_call_handler(PSF(close), 0, NULL); + retval = ps_call_handler(PSF(close), 0, NULL TSRMLS_CC); for (i = 0; i < 6; i++) zval_ptr_dtor(&mdata->names[i]); @@ -124,7 +123,7 @@ SESS_ZVAL_STRING(key, args[0]); - retval = ps_call_handler(PSF(read), 1, args); + retval = ps_call_handler(PSF(read), 1, args TSRMLS_CC); if (retval) { if (Z_TYPE_P(retval) == IS_STRING) { @@ -146,7 +145,7 @@ SESS_ZVAL_STRING(key, args[0]); SESS_ZVAL_STRINGN(val, vallen, args[1]); - retval = ps_call_handler(PSF(write), 2, args); + retval = ps_call_handler(PSF(write), 2, args TSRMLS_CC); FINISH; } @@ -158,7 +157,7 @@ SESS_ZVAL_STRING(key, args[0]); - retval = ps_call_handler(PSF(destroy), 1, args); + retval = ps_call_handler(PSF(destroy), 1, args TSRMLS_CC); FINISH; } @@ -170,7 +169,7 @@ SESS_ZVAL_LONG(maxlifetime, args[0]); - retval = ps_call_handler(PSF(gc), 1, args); + retval = ps_call_handler(PSF(gc), 1, args TSRMLS_CC); FINISH; } Index: php4/ext/session/php_session.h diff -u php4/ext/session/php_session.h:1.72 php4/ext/session/php_session.h:1.73 --- php4/ext/session/php_session.h:1.72 Wed Mar 6 04:02:31 2002 +++ php4/ext/session/php_session.h Wed Mar 6 06:49:51 2002 @@ -21,12 +21,14 @@ #include "ext/standard/php_var.h" -#define PS_OPEN_ARGS void **mod_data, const char *save_path, const char *session_name -#define PS_CLOSE_ARGS void **mod_data -#define PS_READ_ARGS void **mod_data, const char *key, char **val, int *vallen -#define PS_WRITE_ARGS void **mod_data, const char *key, const char *val, const int vallen -#define PS_DESTROY_ARGS void **mod_data, const char *key -#define PS_GC_ARGS void **mod_data, int maxlifetime, int *nrdels +#define PHP_SESSION_API 20020306 + +#define PS_OPEN_ARGS void **mod_data, const char *save_path, const char *session_name TSRMLS_DC +#define PS_CLOSE_ARGS void **mod_data TSRMLS_DC +#define PS_READ_ARGS void **mod_data, const char *key, char **val, int *vallen TSRMLS_DC +#define PS_WRITE_ARGS void **mod_data, const char *key, const char *val, const int vallen TSRMLS_DC +#define PS_DESTROY_ARGS void **mod_data, const char *key TSRMLS_DC +#define PS_GC_ARGS void **mod_data, int maxlifetime, int *nrdels TSRMLS_DC typedef struct ps_module_struct { const char *name; Index: php4/ext/session/session.c diff -u php4/ext/session/session.c:1.289 php4/ext/session/session.c:1.290 --- php4/ext/session/session.c:1.289 Wed Mar 6 06:41:17 2002 +++ php4/ext/session/session.c Wed Mar 6 06:49:51 2002 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: session.c,v 1.289 2002/03/06 11:41:17 sas Exp $ */ +/* $Id: session.c,v 1.290 2002/03/06 11:49:51 sas Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -549,12 +549,12 @@ char *val; int vallen; - if (PS(mod)->open(&PS(mod_data), PS(save_path), PS(session_name)) == FAILURE) { + if (PS(mod)->open(&PS(mod_data), PS(save_path), PS(session_name) TSRMLS_CC) == FAILURE) { php_error(E_ERROR, "Failed to initialize session module"); return; } php_session_track_init(TSRMLS_C); - if (PS(mod)->read(&PS(mod_data), PS(id), &val, &vallen) == SUCCESS) { + if (PS(mod)->read(&PS(mod_data), PS(id), &val, &vallen TSRMLS_CC) == SUCCESS) { php_session_decode(val, vallen TSRMLS_CC); efree(val); } @@ -586,10 +586,10 @@ if (PS(mod_data)) { val = php_session_encode(&vallen TSRMLS_CC); if (val) { - ret = PS(mod)->write(&PS(mod_data), PS(id), val, vallen); + ret = PS(mod)->write(&PS(mod_data), PS(id), val, vallen TSRMLS_CC); efree(val); } else { - ret = PS(mod)->write(&PS(mod_data), PS(id), "", 0); + ret = PS(mod)->write(&PS(mod_data), PS(id), "", 0 TSRMLS_CC); } } @@ -602,7 +602,7 @@ if (PS(mod_data)) - PS(mod)->close(&PS(mod_data)); + PS(mod)->close(&PS(mod_data) TSRMLS_CC); } static char *month_names[] = { @@ -955,7 +955,7 @@ nrand = (int) (100.0*php_combined_lcg(TSRMLS_C)); if (nrand < PS(gc_probability)) { - PS(mod)->gc(&PS(mod_data), PS(gc_maxlifetime), &nrdels); + PS(mod)->gc(&PS(mod_data), PS(gc_maxlifetime), &nrdels TSRMLS_CC); #if 0 if (nrdels != -1) php_error(E_NOTICE, "purged %d expired session objects\n", nrdels); @@ -973,7 +973,7 @@ return FAILURE; } - if (PS(mod)->destroy(&PS(mod_data), PS(id)) == FAILURE) { + if (PS(mod)->destroy(&PS(mod_data), PS(id) TSRMLS_CC) == FAILURE) { retval = FAILURE; php_error(E_WARNING, "Session object destruction failed"); } @@ -1079,7 +1079,7 @@ tempmod = _php_find_ps_module(Z_STRVAL_PP(p_name) TSRMLS_CC); if (tempmod) { if (PS(mod_data)) - PS(mod)->close(&PS(mod_data)); + PS(mod)->close(&PS(mod_data) TSRMLS_CC); PS(mod) = tempmod; PS(mod_data) = NULL; } else { @@ -1414,7 +1414,7 @@ static void php_rshutdown_session_globals(TSRMLS_D) { if (PS(mod_data)) { - PS(mod)->close(&PS(mod_data)); + PS(mod)->close(&PS(mod_data) TSRMLS_CC); } if (PS(id)) { efree(PS(id));

« previous php.cvs (#9726) next »