Home | History | Annotate | Line # | Download | only in zlib
gzclose.c revision 1.1
      1  1.1  christos /* gzclose.c -- zlib gzclose() function
      2  1.1  christos  * Copyright (C) 2004, 2010 Mark Adler
      3  1.1  christos  * For conditions of distribution and use, see copyright notice in zlib.h
      4  1.1  christos  */
      5  1.1  christos 
      6  1.1  christos #include "gzguts.h"
      7  1.1  christos 
      8  1.1  christos /* gzclose() is in a separate file so that it is linked in only if it is used.
      9  1.1  christos    That way the other gzclose functions can be used instead to avoid linking in
     10  1.1  christos    unneeded compression or decompression routines. */
     11  1.1  christos int ZEXPORT gzclose(file)
     12  1.1  christos     gzFile file;
     13  1.1  christos {
     14  1.1  christos #ifndef NO_GZCOMPRESS
     15  1.1  christos     gz_statep state;
     16  1.1  christos 
     17  1.1  christos     if (file == NULL)
     18  1.1  christos         return Z_STREAM_ERROR;
     19  1.1  christos     state = (gz_statep)file;
     20  1.1  christos 
     21  1.1  christos     return state->mode == GZ_READ ? gzclose_r(file) : gzclose_w(file);
     22  1.1  christos #else
     23  1.1  christos     return gzclose_r(file);
     24  1.1  christos #endif
     25  1.1  christos }
     26