aboutsummaryrefslogtreecommitdiff
path: root/lib/libz/gzclose.c
diff options
context:
space:
mode:
authorCem Keylan <cem@ckyln.com>2021-07-14 14:39:31 +0300
committerCem Keylan <cem@ckyln.com>2021-07-14 14:39:31 +0300
commit89c23755c8ab5d8c5bbbfa6e40eb0c6bda109dad (patch)
tree0619d977ce4ceecca0523f20a0609a293440e030 /lib/libz/gzclose.c
parent0ea3661a6ba0baaa39b95e836e8f2c87e2f4c20f (diff)
downloadotools-89c23755c8ab5d8c5bbbfa6e40eb0c6bda109dad.tar.gz
update CVS
Diffstat (limited to 'lib/libz/gzclose.c')
-rw-r--r--lib/libz/gzclose.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/libz/gzclose.c b/lib/libz/gzclose.c
new file mode 100644
index 0000000..b2b4188
--- /dev/null
+++ b/lib/libz/gzclose.c
@@ -0,0 +1,26 @@
+/* $OpenBSD: gzclose.c,v 1.1 2021/07/04 14:24:49 tb Exp $ */
+/* gzclose.c -- zlib gzclose() function
+ * Copyright (C) 2004, 2010 Mark Adler
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+#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 Z_STREAM_ERROR;
+ state = (gz_statep)file;
+
+ return state->mode == GZ_READ ? gzclose_r(file) : gzclose_w(file);
+#else
+ return gzclose_r(file);
+#endif
+}