pike.git
/
src
/
modules
/
Gz
/
zlibmod.c
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/src/modules/Gz/zlibmod.c:1:
/* || This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information.
-
|| $Id: zlibmod.c,v 1.
86
2009/08/
28
13:
30
:
54
mast
Exp $
+
|| $Id: zlibmod.c,v 1.
87
2009/08/
30
13:
44
:
15
grubba
Exp $
*/ #include "global.h" #include "zlib_machine.h" #include "module.h" #include "program.h" #include "module_support.h" #if !defined(HAVE_LIBZ) && !defined(HAVE_LIBGZ) #undef HAVE_ZLIB_H
pike.git/src/modules/Gz/zlibmod.c:222:
default: if(THIS->gz.msg) Pike_error("Failed to initialize Gz.deflate: %s\n",THIS->gz.msg); else Pike_error("Failed to initialize Gz.deflate (%d).\n", tmp); } }
+
#ifdef _REENTRANT
static void do_mt_unlock (PIKE_MUTEX_T *lock) { mt_unlock (lock); }
-
+
#endif
static int do_deflate(dynamic_buffer *buf, struct zipper *this, int flush) { int ret=0;
-
ONERROR uwp;
+
-
+
#ifdef _REENTRANT
+
ONERROR uwp;
THREADS_ALLOW(); mt_lock(& this->lock); THREADS_DISALLOW(); SET_ONERROR (uwp, do_mt_unlock, &this->lock);
-
+
#endif
if(!this->gz.state) ret=Z_STREAM_ERROR; else do { this->gz.next_out=(Bytef *)low_make_buf_space( /* recommended by the zlib people */ (this->gz.avail_out = this->gz.avail_in ?
pike.git/src/modules/Gz/zlibmod.c:263:
ret=deflate(& this->gz, flush); THREADS_DISALLOW(); /* Absorb any unused space /Hubbe */ low_make_buf_space(-((ptrdiff_t)this->gz.avail_out), buf); if(ret == Z_BUF_ERROR) ret=Z_OK; } while (ret==Z_OK && (this->gz.avail_in || !this->gz.avail_out));
+
#ifdef _REENTRANT
CALL_AND_UNSET_ONERROR (uwp);
-
+
#endif
return ret; } void zlibmod_pack(struct pike_string *data, dynamic_buffer *buf, int level, int strategy, int wbits) { struct zipper z; int ret; if(level < Z_NO_COMPRESSION ||