Improve const use in zlib-using code

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Improve const use in zlib-using code
Date: 2023-08-02 09:50:57
Message-ID: 33462926-bb1e-7cc9-8d92-d86318e8ed1d@eisentraut.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Now that we have effectively de-supported CentOS 6, by removing support
for its OpenSSL version, I think we could also modernize the use of some
other libraries, such as zlib.

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); CentOS 6 has
zlib-1.2.3-29.el6.x86_64.

Note that if you use this patch and compile on CentOS 6, it still works,
you just get a few compiler warnings about discarding qualifiers. Old
environments tend to produce more compiler warnings anyway, so this
doesn't seem so bad.

Attachment Content-Type Size
0001-Improve-const-use-in-zlib-using-code.patch text/plain 4.6 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Yugo NAGATA 2023-08-02 10:01:40 Re: pgbnech: allow to cancel queries during benchmark
Previous Message Andrey Lepikhov 2023-08-02 09:43:19 Re: [PoC] Reducing planning time when tables have many partitions