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