CVS update: php3/functions

From: Date: Sat, 17 Oct 1998 21:41:05 +0000
Subject: CVS update: php3/functions
Groups: php.dev 
Request: Send a blank email to php-dev+get-1898@lists.php.net to get a copy of this message
Date: Saturday October 17, 1998 @ 17:41 Author: shane Update of /repository/php3/functions In directory asf:/u2/tmp/cvs-serv463/functions Modified Files: db.c Log Message: dbm update for 3.0/3.1 compilation Index: php3/functions/db.c diff -c php3/functions/db.c:1.77 php3/functions/db.c:1.78 *** php3/functions/db.c:1.77 Sat Sep 19 16:17:15 1998 --- php3/functions/db.c Sat Oct 17 17:41:04 1998 *************** *** 28,37 **** +----------------------------------------------------------------------+ */ ! /* $Id: db.c,v 1.77 1998/09/19 20:17:15 rasmus Exp $ */ #if COMPILE_DL ! #include "dl/phpdl.h" #endif #include "php.h" #include "internal_functions.h" --- 28,45 ---- +----------------------------------------------------------------------+ */ ! /* $Id: db.c,v 1.78 1998/10/17 21:41:04 shane Exp $ */ ! #define IS_EXT_MODULE #if COMPILE_DL ! #ifdef PHP_31 ! # include "../phpdl.h" ! #else ! # ifdef THREAD_SAFE ! # undef THREAD_SAFE ! # endif ! # include "dl/phpdl.h" #endif + #endif #include "php.h" #include "internal_functions.h" *************** *** 48,54 **** --- 56,66 ---- #if HAVE_SYS_FILE_H && !HAVE_LOCKF && HAVE_FLOCK #if WIN32|WINNT + #ifdef PHP_31 + #include "os/nt/flock.h" + #else #include "win32/flock.h" + #endif #else #include <sys/file.h> #endif *************** *** 149,156 **** --- 161,173 ---- datum flatfile_nextkey(FILE *dbf); #endif + #ifdef PHP_31 + #include "php3_db.h" + #include "ext/standard/php3_string.h" + #else #include "functions/db.h" #include "functions/php3_string.h" + #endif #if THREAD_SAFE DWORD DbmTls; *************** *** 161,171 **** }dbm_global_struct; #define DBM_GLOBAL(a) dbm_globals->a - #define DBM_TLS_VARS \ - dbm_global_struct *dbm_globals; \ - dbm_globals=TlsGetValue(DbmTls); - #else static int le_db; #define DBM_GLOBAL(a) a --- 178,185 ---- }dbm_global_struct; #define DBM_GLOBAL(a) dbm_globals->a + #define DBM_TLS_VARS dbm_global_struct *dbm_globals = TlsGetValue(DbmTls); #else static int le_db; #define DBM_GLOBAL(a) a *************** *** 244,250 **** void php3_info_db(void) { ! PUTS(php3_get_info_db()); } void php3_dblist(INTERNAL_FUNCTION_PARAMETERS) --- 258,264 ---- void php3_info_db(void) { ! php3_printf(php3_get_info_db()); } void php3_dblist(INTERNAL_FUNCTION_PARAMETERS) *************** *** 296,304 **** --- 310,320 ---- return NULL; } + #ifndef PHP_31 /* FIXME php3_ini cannot be accessed in modules */ if (php3_ini.safe_mode && (!_php3_checkuid(filename, 2))) { return NULL; } + #endif if (_php3_check_open_basedir(filename)) { return NULL; *************** *** 551,560 **** --- 567,578 ---- int ret; datum key_datum, value_datum; + #ifndef PHP_31 /* FIXME php3_ini cannot be accessed in modules */ if (php3_ini.magic_quotes_runtime) { _php3_stripslashes(key,NULL); _php3_stripslashes(value,NULL); } + #endif value_datum.dptr = estrdup(value); value_datum.dsize = strlen(value); *************** *** 642,650 **** --- 660,670 ---- else ret = NULL; + #ifndef PHP_31 /* FIXME php3_ini cannot be accessed in modules */ if (ret && php3_ini.magic_quotes_runtime) { ret = _php3_addslashes(ret, value_datum.dsize, NULL, 1); } + #endif return(ret); } *************** *** 856,864 **** --- 876,886 ---- } else ret=NULL; + #ifndef PHP_31 /* FIXME php3_ini cannot be accessed in modules */ if (ret && php3_ini.magic_quotes_runtime) { ret = _php3_addslashes(ret, ret_datum.dsize, NULL, 1); } + #endif return(ret); } *************** *** 1091,1111 **** int php3_minit_db(INIT_FUNC_ARGS) { ! #ifdef THREAD_SAFE dbm_global_struct *dbm_globals; ! #if !COMPILE_DL ! CREATE_MUTEX(dbm_mutex,"DBM_TLS"); ! SET_MUTEX(dbm_mutex); numthreads++; if (numthreads==1){ ! if ((DbmTls=TlsAlloc())==0xFFFFFFFF){ ! FREE_MUTEX(dbm_mutex); ! return 0; ! }} ! FREE_MUTEX(dbm_mutex); ! #endif ! dbm_globals = (dbm_global_struct *) LocalAlloc(LPTR, sizeof(dbm_global_struct)); ! TlsSetValue(DbmTls, (void *) dbm_globals); #endif DBM_GLOBAL(le_db) = register_list_destructors(_php3_dbmclose,NULL); --- 1113,1135 ---- int php3_minit_db(INIT_FUNC_ARGS) { ! #if defined(THREAD_SAFE) dbm_global_struct *dbm_globals; ! PHP3_MUTEX_ALLOC(dbm_mutex); ! PHP3_MUTEX_LOCK(dbm_mutex); numthreads++; if (numthreads==1){ ! if (!PHP3_TLS_PROC_STARTUP(DbmTls)){ ! PHP3_MUTEX_UNLOCK(dbm_mutex); ! PHP3_MUTEX_FREE(dbm_mutex); ! return FAILURE; ! } ! } ! PHP3_MUTEX_UNLOCK(dbm_mutex); ! if(!PHP3_TLS_THREAD_INIT(DbmTls,dbm_globals,dbm_global_struct)){ ! PHP3_MUTEX_FREE(dbm_mutex); ! return FAILURE; ! } #endif DBM_GLOBAL(le_db) = register_list_destructors(_php3_dbmclose,NULL); *************** *** 1113,1133 **** } static int php3_mend_db(void){ #ifdef THREAD_SAFE ! dbm_global_struct *dbm_globals; ! dbm_globals = TlsGetValue(DbmTls); ! if (dbm_globals != 0) ! LocalFree((HLOCAL) dbm_globals); ! #if !COMPILE_DL ! SET_MUTEX(dbm_mutex); numthreads--; ! if (!numthreads){ ! if (!TlsFree(DbmTls)){ ! FREE_MUTEX(dbm_mutex); ! return 0; ! }} ! FREE_MUTEX(dbm_mutex); ! #endif #endif return SUCCESS; } --- 1137,1154 ---- } static int php3_mend_db(void){ + DBM_TLS_VARS; #ifdef THREAD_SAFE ! PHP3_TLS_THREAD_FREE(dbm_globals); ! PHP3_MUTEX_LOCK(dbm_mutex); numthreads--; ! if (numthreads<1) { ! PHP3_TLS_PROC_SHUTDOWN(DbmTls); ! PHP3_MUTEX_UNLOCK(dbm_mutex); ! PHP3_MUTEX_FREE(dbm_mutex); ! return SUCCESS; ! } ! PHP3_MUTEX_UNLOCK(dbm_mutex); #endif return SUCCESS; } *************** *** 1160,1193 **** #if COMPILE_DL DLEXPORT php3_module_entry *get_module(void) { return &dbm_module_entry; } - - #if (WIN32|WINNT) && defined(THREAD_SAFE) - - /*NOTE: You should have an odbc.def file where you - export DllMain*/ - BOOL WINAPI DllMain(HANDLE hModule, - DWORD ul_reason_for_call, - LPVOID lpReserved) - { - switch( ul_reason_for_call ) { - case DLL_PROCESS_ATTACH: - if ((DbmTls=TlsAlloc())==0xFFFFFFFF){ - return 0; - } - break; - case DLL_THREAD_ATTACH: - break; - case DLL_THREAD_DETACH: - break; - case DLL_PROCESS_DETACH: - if (!TlsFree(DbmTls)){ - return 0; - } - break; - } - return 1; - } - #endif #endif /* --- 1181,1186 ---- -- PHP Development Mailing List http://www.php.net/ To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net For help: php-dev-help@lists.php.net

« previous php.dev (#1898) next »