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.1.2 christos int ZEXPORT gzclose(gzFile file) { 12 1.1 christos #ifndef NO_GZCOMPRESS 13 1.1 christos gz_statep state; 14 1.1 christos 15 1.1 christos if (file == NULL) 16 1.1 christos return Z_STREAM_ERROR; 17 1.1 christos state = (gz_statep)file; 18 1.1 christos 19 1.1 christos return state->mode == GZ_READ ? gzclose_r(file) : gzclose_w(file); 20 1.1 christos #else 21 1.1 christos return gzclose_r(file); 22 1.1 christos #endif 23 1.1 christos } 24