summaryrefslogtreecommitdiff
path: root/src/include/c.h
diff options
context:
space:
mode:
authorPeter Eisentraut <peter@eisentraut.org>2023-08-07 09:06:52 +0200
committerPeter Eisentraut <peter@eisentraut.org>2023-08-07 09:34:38 +0200
commit67c0ef9752ade6dc252a19be8d2259847d4eb78d (patch)
treebefd5e6f1a42b22ca1e629199b6ed954e2c72024 /src/include/c.h
parentfdd79d8992d600d38eecfab568b27f6d04e4dfb3 (diff)
Improve const use in zlib-using code
If we define ZLIB_CONST before including zlib.h, zlib augments some interfaces with const decorations. By doing that we can keep our own interfaces cleaner and can remove some unconstify calls. ZLIB_CONST was introduced in zlib 1.2.5.2 (17 Dec 2011). When compiling with older zlib releases, you might now get compiler warnings about discarding qualifiers. CentOS 6 has zlib 1.2.3, but in 8e278b6576, we removed support for the OpenSSL release in CentOS 6, so it seems ok to de-support the zlib release in CentOS 6 as well. Reviewed-by: Tristan Partin <tristan@neon.tech> Discussion: https://www.postgresql.org/message-id/flat/33462926-bb1e-7cc9-8d92-d86318e8ed1d%40eisentraut.org
Diffstat (limited to 'src/include/c.h')
-rw-r--r--src/include/c.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/include/c.h b/src/include/c.h
index f69d739be57..82f8e9d4c7b 100644
--- a/src/include/c.h
+++ b/src/include/c.h
@@ -75,6 +75,11 @@
#include <libintl.h>
#endif
+/* Define before including zlib.h to add const decorations to zlib API. */
+#ifdef HAVE_LIBZ
+#define ZLIB_CONST
+#endif
+
/* ----------------------------------------------------------------
* Section 1: compiler characteristics