cvs: /php3/functions zlib.c

From: Date: Tue, 07 Sep 1999 09:21:53 +0000
Subject: cvs: /php3/functions zlib.c
Groups: php.dev 
Request: Send a blank email to php-dev+get-10651@lists.php.net to get a copy of this message
sr Tue Sep 7 05:21:53 1999 EDT Modified files: /php3/functions zlib.c Log: Removed unused THREAD_SAFE stuff. Fixed prototype. Index: php3/functions/zlib.c diff -u php3/functions/zlib.c:1.18 php3/functions/zlib.c:1.19 --- php3/functions/zlib.c:1.18 Mon Sep 6 11:43:10 1999 +++ php3/functions/zlib.c Tue Sep 7 05:21:53 1999 @@ -22,15 +22,9 @@ | Stefan Röhrich <sr@linux.de> | +----------------------------------------------------------------------+ */ -/* $Id: zlib.c,v 1.18 1999/09/06 15:43:10 sr Exp $ */ -#if !PHP_31 && defined(THREAD_SAFE) -#undef THREAD_SAFE -#endif +/* $Id: zlib.c,v 1.19 1999/09/07 09:21:53 sr Exp $ */ #define IS_EXT_MODULE -#ifdef THREAD_SAFE -#include "tls.h" -#endif #include "php.h" #include <stdio.h> @@ -82,31 +76,11 @@ #define PHPWRITE(a,n) php3_write((a),(n)) #endif #endif - - - -#if defined(THREAD_SAFE) -typedef struct zlib_global_struct{ -#endif - int gzgetss_state; - int le_zp; -#if defined(THREAD_SAFE) -}zlib_global_struct; -#endif - -#if defined(THREAD_SAFE) -DWORD ZLIBtls; -static int numthreads=0; -void *zlib_mutex; -#define ZLIB_GLOBAL(a) zlib_globals->a +int gzgetss_state; +int le_zp; -#define ZLIB_TLS_VARS zlib_global_struct *PHP3_TLS_GET(ZLIBtls,zlib_globals); - -#else #define ZLIB_GLOBAL(a) a -#define ZLIB_TLS_VARS -#endif #define ZLIB_INI(a) php3_ini.a @@ -143,43 +117,11 @@ int php3_minit_zlib(INIT_FUNC_ARGS) { -#ifdef THREAD_SAFE - zlib_global_struct *zlib_globals; - PHP3_MUTEX_ALLOC(zlib_mutex); - PHP3_MUTEX_LOCK(zlib_mutex); - numthreads++; - if (numthreads==1){ - if (!PHP3_TLS_PROC_STARTUP(ZLIBtls)){ - PHP3_MUTEX_UNLOCK(zlib_mutex); - PHP3_MUTEX_FREE(zlib_mutex); - return FAILURE; - } - } - PHP3_MUTEX_UNLOCK(zlib_mutex); - if(!PHP3_TLS_THREAD_INIT(ZLIBtls,zlib_globals,zlib_global_struct)){ - PHP3_MUTEX_FREE(zlib_mutex); - return FAILURE; - } -#endif - ZLIB_GLOBAL(le_zp) = register_list_destructors(php3i_destructor_gzclose,NULL); return SUCCESS; } -int php3_mshutdown_zlib(void){ -#if defined(THREAD_SAFE) - ZLIB_TLS_VARS; - PHP3_TLS_THREAD_FREE(zlib_globals); - PHP3_MUTEX_LOCK(zlib_mutex); - numthreads--; - if (numthreads<1){ - PHP3_TLS_PROC_SHUTDOWN(ZLIBtls); - PHP3_MUTEX_UNLOCK(zlib_mutex); - PHP3_MUTEX_FREE(zlib_mutex); - return SUCCESS; - } - PHP3_MUTEX_UNLOCK(zlib_mutex); -#endif +int php3_mshutdown_zlib(void) { return SUCCESS; } @@ -196,7 +138,6 @@ static gzFile php3_gzopen_wrapper(char *path, char *mode, int options) { - ZLIB_TLS_VARS; if (options & USE_PATH && ZLIB_INI(include_path) != NULL) { return php3_gzopen_with_path(path, mode, ZLIB_INI(include_path), NULL); } @@ -219,7 +160,6 @@ char trypath[MAXPATHLEN + 1]; struct stat sb; gzFile *zp; - ZLIB_TLS_VARS; if (opened_path) { *opened_path = NULL; @@ -312,7 +252,7 @@ return NULL; } -/* {{{ proto array gzfile(string filename) +/* {{{ proto array gzfile(string filename [, int use_include_path]) Read und uncompress entire .gz-file into an array */ void php3_gzfile(INTERNAL_FUNCTION_PARAMETERS) { pval *filename, *arg2; @@ -320,7 +260,6 @@ char *slashed, buf[8192]; register int i=0; int use_include_path = 0; - ZLIB_TLS_VARS; /* check args */ switch (ARG_COUNT(ht)) { @@ -376,7 +315,6 @@ char *p; int id; int use_include_path = 0; - ZLIB_TLS_VARS; switch(ARG_COUNT(ht)) { case 2: @@ -422,7 +360,6 @@ pval *arg1; int id, type; gzFile *zp; - ZLIB_TLS_VARS; if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg1) == FAILURE) { WRONG_PARAM_COUNT; @@ -445,7 +382,6 @@ pval *arg1; gzFile *zp; int id, type; - ZLIB_TLS_VARS; if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg1) == FAILURE) { WRONG_PARAM_COUNT; @@ -473,7 +409,6 @@ gzFile *zp; int id, len, type; char *buf; - ZLIB_TLS_VARS; if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) { WRONG_PARAM_COUNT; @@ -514,7 +449,6 @@ gzFile *zp; int id, type, c; char *buf; - ZLIB_TLS_VARS; if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg1) == FAILURE) { WRONG_PARAM_COUNT; @@ -551,7 +485,6 @@ gzFile *zp; int id, len, br, type; char *buf, *p, *rbuf, *rp, c, lc; - ZLIB_TLS_VARS; if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &fd, &bytes) == FAILURE) { WRONG_PARAM_COUNT; @@ -671,7 +604,6 @@ gzFile *zp; int ret,id,type; int num_bytes; - ZLIB_TLS_VARS; switch (ARG_COUNT(ht)) { case 2: @@ -719,7 +651,6 @@ pval *arg1; int id,type; gzFile *zp; - ZLIB_TLS_VARS; if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg1) == FAILURE) { WRONG_PARAM_COUNT; @@ -743,7 +674,6 @@ int id, type; long pos; gzFile *zp; - ZLIB_TLS_VARS; if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg1) == FAILURE) { WRONG_PARAM_COUNT; @@ -767,7 +697,6 @@ int ret,id,type; long pos; gzFile *zp; - ZLIB_TLS_VARS; if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) { WRONG_PARAM_COUNT; @@ -849,7 +778,6 @@ gzFile *zp; char buf[8192]; int id, size, b, type; - ZLIB_TLS_VARS; if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg1) == FAILURE) { WRONG_PARAM_COUNT; @@ -881,7 +809,6 @@ pval *arg1, *arg2; gzFile *zp; int id, len, type; - ZLIB_TLS_VARS; if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) { WRONG_PARAM_COUNT;

« previous php.dev (#10651) next »