summaryrefslogtreecommitdiff
path: root/gzlib.c
diff options
context:
space:
mode:
authorNathan Moinvaziri <nathan@nathanm.com>2020-09-13 21:58:57 -0700
committerHans Kristian Rosbach <hk-github@circlestorm.org>2020-09-16 09:10:28 +0200
commit601a99764444dcd4cb85dc828a3821fdaff444ec (patch)
tree7ae70190d7454b114a7171784737577775227486 /gzlib.c
parentfebeec521859b908e34208cf6f6ff29df2cbf4b9 (diff)
Move gzclose() to gzlib.c. Modern linkers should be smart enough to link it in only if it is used.
Diffstat (limited to 'gzlib.c')
-rw-r--r--gzlib.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/gzlib.c b/gzlib.c
index de99174..4905516 100644
--- a/gzlib.c
+++ b/gzlib.c
@@ -242,6 +242,20 @@ gzFile Z_EXPORT PREFIX(gzopen_w)(const wchar_t *path, const char *mode) {
}
#endif
+int Z_EXPORT PREFIX(gzclose)(gzFile file) {
+#ifndef NO_GZCOMPRESS
+ gz_state *state;
+
+ if (file == NULL)
+ return Z_STREAM_ERROR;
+ state = (gz_state *)file;
+
+ return state->mode == GZ_READ ? PREFIX(gzclose_r)(file) : PREFIX(gzclose_w)(file);
+#else
+ return PREFIX(gzclose_r)(file);
+#endif
+}
+
/* -- see zlib.h -- */
int Z_EXPORT PREFIX(gzbuffer)(gzFile file, unsigned size) {
gz_state *state;