annotate src/zlib-1.2.8/gzclose.c @ 43:5ea0608b923f

Current zlib source
author Chris Cannam
date Tue, 18 Oct 2016 14:33:52 +0100
parents
children
rev   line source
Chris@43 1 /* gzclose.c -- zlib gzclose() function
Chris@43 2 * Copyright (C) 2004, 2010 Mark Adler
Chris@43 3 * For conditions of distribution and use, see copyright notice in zlib.h
Chris@43 4 */
Chris@43 5
Chris@43 6 #include "gzguts.h"
Chris@43 7
Chris@43 8 /* gzclose() is in a separate file so that it is linked in only if it is used.
Chris@43 9 That way the other gzclose functions can be used instead to avoid linking in
Chris@43 10 unneeded compression or decompression routines. */
Chris@43 11 int ZEXPORT gzclose(file)
Chris@43 12 gzFile file;
Chris@43 13 {
Chris@43 14 #ifndef NO_GZCOMPRESS
Chris@43 15 gz_statep state;
Chris@43 16
Chris@43 17 if (file == NULL)
Chris@43 18 return Z_STREAM_ERROR;
Chris@43 19 state = (gz_statep)file;
Chris@43 20
Chris@43 21 return state->mode == GZ_READ ? gzclose_r(file) : gzclose_w(file);
Chris@43 22 #else
Chris@43 23 return gzclose_r(file);
Chris@43 24 #endif
Chris@43 25 }