aboutsummaryrefslogtreecommitdiffhomepage
path: root/third_party/zlib/gzclose.c
diff options
context:
space:
mode:
authorGravatar Lukacs T. Berki <lberki@google.com>2016-04-06 15:50:52 +0200
committerGravatar Lukacs T. Berki <lberki@google.com>2016-04-06 15:52:14 +0200
commit653869eab2de21c5d77c68fc67f14d4463244622 (patch)
tree77f3133424ea8c4560ec9aed017df92481188c7c /third_party/zlib/gzclose.c
parentfd16ed1fac179cb16eafd487d3816bdcbc320e7f (diff)
Add zlib to the third_party directory.
zlib is the only dependency of Bazel that comes from the host system, so let's change that. There isn't much point in using the preinstalled version of a single library while having everything else under third_party/ . Change-Id: I60c129a41ff4a1b532f8b1d6e2508bd6e6b0a755
Diffstat (limited to 'third_party/zlib/gzclose.c')
-rw-r--r--third_party/zlib/gzclose.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/third_party/zlib/gzclose.c b/third_party/zlib/gzclose.c
new file mode 100644
index 0000000000..caeb99a317
--- /dev/null
+++ b/third_party/zlib/gzclose.c
@@ -0,0 +1,25 @@
+/* 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
+}