summaryrefslogtreecommitdiff
path: root/gzclose.c
diff options
context:
space:
mode:
authorMark Adler <madler@alumni.caltech.edu>2011-09-09 23:26:49 -0700
committerMark Adler <madler@alumni.caltech.edu>2011-09-09 23:26:49 -0700
commitd004b047838a7e803818b4973a2e39e0ff8c1fa2 (patch)
tree9e8c804f78d73152c70d4ff24c6a7531a0d46782 /gzclose.c
parentf6194ef39af5864f792412460c354cc339dde7d1 (diff)
downloadzlib-d004b047838a7e803818b4973a2e39e0ff8c1fa2.tar.gz
zlib 1.2.3.5v1.2.3.5
Diffstat (limited to 'gzclose.c')
-rw-r--r--gzclose.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/gzclose.c b/gzclose.c
new file mode 100644
index 0000000..2cf2843
--- /dev/null
+++ b/gzclose.c
@@ -0,0 +1,29 @@
+/* gzclose.c -- zlib gzclose() function
+ * Copyright (C) 2004, 2010 Mark Adler
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+#ifndef OLD_GZIO
+
+#include "gzguts.h"
+
+/* gzclose() is in a separate file so that it is linked in only if it is used.
+ That way the other gzclose functions can be used instead to avoid linking in
+ unneeded compression or decompression routines. */
+int ZEXPORT gzclose(file)
+ gzFile file;
+{
+#ifndef NO_GZCOMPRESS
+ gz_statep state;
+
+ if (file == NULL)
+ return EOF;
+ state = (gz_statep)file;
+
+ return state->mode == GZ_READ ? gzclose_r(file) : gzclose_w(file);
+#else
+ return gzclose_r(file);
+#endif
+}
+
+#endif /* !OLD_GZIO */