Thread
Commits
-
pgcrypto: Remove static storage class from variables
- affd38e55a3c 18.0 landed
-
Remove unnecessary static specifier
Japin Li <japinli@hotmail.com> — 2025-02-05T12:30:44Z
Hi, When reviewing patch [1], I find that the static class specifier is unnecessary for the variables sp and ep in the function px_crypt_md5().
-
Re: Remove unnecessary static specifier
Daniel Gustafsson <daniel@yesql.se> — 2025-02-05T12:52:53Z
> On 5 Feb 2025, at 13:30, Japin Li <japinli@hotmail.com> wrote: > When reviewing patch [1], I find that the static class specifier is unnecessary > for the variables sp and ep in the function px_crypt_md5(). From a quick first inspection (and running the tests with the patch applied) I agree with this, these variables do not need to be static. I'll stare a bit more at this to make sure but seems like the right patch. -- Daniel Gustafsson
-
Re: Remove unnecessary static specifier
Tom Lane <tgl@sss.pgh.pa.us> — 2025-02-05T16:05:15Z
Daniel Gustafsson <daniel@yesql.se> writes: > From a quick first inspection (and running the tests with the patch applied) I > agree with this, these variables do not need to be static. I'll stare a bit > more at this to make sure but seems like the right patch. +1. All three of those variables are visibly assigned to before any other reference, so they cannot carry data across calls of the function. While we're at it, could we make the adjacent "magic" string be "static const char *magic"? (Probably needs a couple more "const" modifiers at use sites, too.) regards, tom lane
-
Re: Remove unnecessary static specifier
Daniel Gustafsson <daniel@yesql.se> — 2025-02-05T17:17:37Z
> On 5 Feb 2025, at 17:05, Tom Lane <tgl@sss.pgh.pa.us> wrote: > While we're at it, could we make the adjacent "magic" string be > "static const char *magic"? (Probably needs a couple more > "const" modifiers at use sites, too.) Good point, from the link referenced it's clear that FreeBSD has made that change as well. I'll fix that at the same time. -- Daniel Gustafsson
-
Re: Remove unnecessary static specifier
Japin Li <japinli@hotmail.com> — 2025-02-06T01:51:54Z
On Wed, 05 Feb 2025 at 18:17, Daniel Gustafsson <daniel@yesql.se> wrote: >> On 5 Feb 2025, at 17:05, Tom Lane <tgl@sss.pgh.pa.us> wrote: > >> While we're at it, could we make the adjacent "magic" string be >> "static const char *magic"? (Probably needs a couple more >> "const" modifiers at use sites, too.) > > Good point, from the link referenced it's clear that FreeBSD has made that > change as well. I'll fix that at the same time. > Oh, I didn't notice this. +1. -- Regrads, Japin Li
-
Re: Remove unnecessary static specifier
Daniel Gustafsson <daniel@yesql.se> — 2025-02-06T15:39:51Z
> On 6 Feb 2025, at 02:51, Japin Li <japinli@hotmail.com> wrote: > > On Wed, 05 Feb 2025 at 18:17, Daniel Gustafsson <daniel@yesql.se> wrote: >>> On 5 Feb 2025, at 17:05, Tom Lane <tgl@sss.pgh.pa.us> wrote: >> >>> While we're at it, could we make the adjacent "magic" string be >>> "static const char *magic"? (Probably needs a couple more >>> "const" modifiers at use sites, too.) >> >> Good point, from the link referenced it's clear that FreeBSD has made that >> change as well. I'll fix that at the same time. > > Oh, I didn't notice this. +1. Committed, thanks! -- Daniel Gustafsson