00001 /* gzclose.c -- zlib gzclose() function 00002 * Copyright (C) 2004, 2010 Mark Adler 00003 * For conditions of distribution and use, see copyright notice in zlib.h 00004 */ 00005 00006 #include "gzguts.h" 00007 00008 /* gzclose() is in a separate file so that it is linked in only if it is used. 00009 That way the other gzclose functions can be used instead to avoid linking in 00010 unneeded compression or decompression routines. */ 00011 int ZEXPORT gzclose(file) 00012 gzFile file; 00013 { 00014 #ifndef NO_GZCOMPRESS 00015 gz_statep state; 00016 00017 if (file == NULL) 00018 return Z_STREAM_ERROR; 00019 state = (gz_statep)file; 00020 00021 return state->mode == GZ_READ ? gzclose_r(file) : gzclose_w(file); 00022 #else 00023 return gzclose_r(file); 00024 #endif 00025 }