File indexing completed on 2024-04-21 03:48:30

0001 /* gzclose.c -- zlib gzclose() function
0002  * Copyright (C) 2004, 2010 Mark Adler
0003  * For conditions of distribution and use, see copyright notice in zlib.h
0004  */
0005 
0006 #include "gzguts.h"
0007 
0008 /* gzclose() is in a separate file so that it is linked in only if it is used.
0009    That way the other gzclose functions can be used instead to avoid linking in
0010    unneeded compression or decompression routines. */
0011 int ZEXPORT gzclose(file)
0012     gzFile file;
0013 {
0014 #ifndef NO_GZCOMPRESS
0015     gz_statep state;
0016 
0017     if (file == NULL)
0018         return Z_STREAM_ERROR;
0019     state = (gz_statep)file;
0020 
0021     return state->mode == GZ_READ ? gzclose_r(file) : gzclose_w(file);
0022 #else
0023     return gzclose_r(file);
0024 #endif
0025 }