pike.git / src / modules / Gz / zlibmod.c

version» Context lines:

pike.git/src/modules/Gz/zlibmod.c:1:   /*\   ||| This file a part of Pike, and is copyright by Fredrik Hubinette   ||| Pike is distributed as GPL (General Public License)   ||| See the files COPYING and DISCLAIMER for more information.   \*/   #include "global.h" - RCSID("$Id: zlibmod.c,v 1.9 1997/07/19 20:29:59 hubbe Exp $"); + RCSID("$Id: zlibmod.c,v 1.10 1997/08/31 22:25:33 per Exp $");      #include "zlib_machine.h"      #if !defined(HAVE_LIBZ) && !defined(HAVE_LIBGZ)   #undef HAVE_ZLIB_H   #endif      #ifdef HAVE_ZLIB_H      #include "interpret.h"
pike.git/src/modules/Gz/zlibmod.c:39:   #define BUF 16384      #define THIS ((struct zipper *)(fp->current_storage))      static void gz_deflate_create(INT32 args)   {    int level=Z_DEFAULT_COMPRESSION;       if(THIS->gz.state)    { -  mt_lock(& THIS->lock); + /* mt_lock(& THIS->lock); */    deflateEnd(&THIS->gz); -  mt_unlock(& THIS->lock); + /* mt_unlock(& THIS->lock); */    }       if(args)    {    if(sp[-args].type != T_INT)    error("Bad argument 1 to gz->create()\n");    level=sp[-args].u.integer;    if(level < Z_NO_COMPRESSION ||    level > Z_BEST_COMPRESSION)    {    error("Compression level out of range for gz_deflate->create()\n");    }    }       THIS->gz.zalloc=Z_NULL;    THIS->gz.zfree=Z_NULL;    THIS->gz.opaque=THIS;       pop_n_elems(args); -  mt_lock(& THIS->lock); + /* mt_lock(& THIS->lock); */    level=deflateInit(&THIS->gz, level); -  mt_unlock(& THIS->lock); + /* mt_unlock(& THIS->lock); */    switch(level)    {    case Z_OK:    return;       case Z_VERSION_ERROR:    error("libz not compatible with zlib.h!!!\n");    break;       default:
pike.git/src/modules/Gz/zlibmod.c:188:    mt_init(& THIS->lock);    MEMSET(& THIS->gz, 0, sizeof(THIS->gz));    THIS->gz.zalloc=Z_NULL;    THIS->gz.zfree=Z_NULL;    THIS->gz.opaque=THIS;    deflateInit(& THIS->gz, Z_DEFAULT_COMPRESSION);   }      static void exit_gz_deflate(struct object *o)   { -  mt_lock(& THIS->lock); + /* mt_lock(& THIS->lock); */    deflateEnd(&THIS->gz); -  mt_unlock(& THIS->lock); + /* mt_unlock(& THIS->lock); */   }      /*******************************************************************/         static void gz_inflate_create(INT32 args)   {    int tmp;    if(THIS->gz.state)    { -  mt_lock(& THIS->lock); + /* mt_lock(& THIS->lock); */    inflateEnd(&THIS->gz); -  mt_unlock(& THIS->lock); + /* mt_unlock(& THIS->lock); */    }          THIS->gz.zalloc=Z_NULL;    THIS->gz.zfree=Z_NULL;    THIS->gz.opaque=THIS;       pop_n_elems(args); -  mt_lock(& THIS->lock); + /* mt_lock(& THIS->lock); */    tmp=inflateInit(& THIS->gz); -  mt_unlock(& THIS->lock); + /* mt_unlock(& THIS->lock); */    switch(tmp)    {    case Z_OK:    return;       case Z_VERSION_ERROR:    error("libz not compatible with zlib.h!!!\n");    break;       default:
pike.git/src/modules/Gz/zlibmod.c:237:    else    error("Failed to initialize gz_inflate\n");    }   }      static int do_inflate(dynamic_buffer *buf,    struct zipper *this,    int flush)   {    int fail=0; -  +     THREADS_ALLOW(); -  mt_lock(& THIS->lock); +  mt_lock(& this->lock);    if(!this->gz.state)    {    fail=Z_STREAM_ERROR;    }else{    do    {    char *loc;    int ret;    loc=low_make_buf_space(BUF,buf);    this->gz.next_out=(Bytef *)loc;    this->gz.avail_out=BUF;    ret=inflate(& this->gz, flush);    low_make_buf_space(-this->gz.avail_out,buf);    if(ret != Z_OK)    {    fail=ret;    break;    }    } while(!this->gz.avail_out || flush==Z_FINISH || this->gz.avail_in);    } -  mt_unlock(& THIS->lock); +  mt_unlock(& this->lock);    THREADS_DISALLOW();    return fail;   }      static void gz_inflate(INT32 args)   {    struct pike_string *data;    int fail;    struct zipper *this=THIS;    dynamic_buffer buf;
pike.git/src/modules/Gz/zlibmod.c:320:    MEMSET(& THIS->gz, 0, sizeof(THIS->gz));    THIS->gz.zalloc=Z_NULL;    THIS->gz.zfree=Z_NULL;    THIS->gz.opaque=0;    inflateInit(&THIS->gz);    inflateEnd(&THIS->gz);   }      static void exit_gz_inflate(struct object *o)   { -  mt_lock(& THIS->lock); + /* mt_lock(& THIS->lock); */    inflateEnd(& THIS->gz); -  mt_unlock(& THIS->lock); + /* mt_unlock(& THIS->lock); */   }      #endif      void pike_module_exit(void) {}      void pike_module_init(void)   {   #ifdef HAVE_ZLIB_H    start_new_program();