michael@0: /* gzclose.c -- zlib gzclose() function michael@0: * Copyright (C) 2004, 2010 Mark Adler michael@0: * For conditions of distribution and use, see copyright notice in zlib.h michael@0: */ michael@0: michael@0: #include "gzguts.h" michael@0: michael@0: /* gzclose() is in a separate file so that it is linked in only if it is used. michael@0: That way the other gzclose functions can be used instead to avoid linking in michael@0: unneeded compression or decompression routines. */ michael@0: int ZEXPORT gzclose(file) michael@0: gzFile file; michael@0: { michael@0: #ifndef NO_GZCOMPRESS michael@0: gz_statep state; michael@0: michael@0: if (file == NULL) michael@0: return Z_STREAM_ERROR; michael@0: state = (gz_statep)file; michael@0: michael@0: return state->mode == GZ_READ ? gzclose_r(file) : gzclose_w(file); michael@0: #else michael@0: return gzclose_r(file); michael@0: #endif michael@0: }