| From: | Nathan Bossart <nathandbossart(at)gmail(dot)com> |
|---|---|
| To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
| Cc: | pgsql-hackers(at)lists(dot)postgresql(dot)org |
| Subject: | Re: Cleaning up pgcrypto/crypt-des.c to avoid compiler warnings |
| Date: | 2026-09-25 18:54:58 |
| Message-ID: | arbDghG1ccMXTSZH@nathan |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Fri, Sep 25, 2026 at 01:58:17PM -0400, Tom Lane wrote:
> I think this odd coding, perhaps combined with all the cowboy casting
> that's going on here, is what's confusing gcc into giving a warning.
> I propose the attached patch to make this code less ugly and (with
> luck) suppress the warning.
Getting rid of the "q" variable altogether might have a better chance of
clearing the warnings, and IMHO it further improves readability:
> + q = &keybuf.bytes[0];
> + while (q < &keybuf.bytes[8])
> {
> *q++ = *key << 1;
for (i = 0; i < 8; i++)
{
keybuf.bytes[i] = *key << 1;
> + q = &keybuf.bytes[0];
> + while (q < &keybuf.bytes[8] && *key)
> *q++ ^= *key++ << 1;
for (i = 0; i < 8 && *key; i++)
keybuf.bytes[i] ^= *key++ << 1;
--
nathan
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Ayush Tiwari | 2026-09-25 19:13:42 | [PATCH] Table sync race with REFRESH PUBLICATION |
| Previous Message | Tom Lane | 2026-09-25 18:54:45 | Re: [PATCH] btree_gist: add cross-type integer operator support for GiST |