Remove unnecessary static specifier - Mailing list pgsql-hackers

From Japin Li
Subject Remove unnecessary static specifier
Date
Msg-id ME0P300MB0445096B67ACE8CE25772F00B6F72@ME0P300MB0445.AUSP300.PROD.OUTLOOK.COM
Whole thread Raw
Responses Re: Remove unnecessary static specifier
List pgsql-hackers
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().

diff --git a/contrib/pgcrypto/crypt-md5.c b/contrib/pgcrypto/crypt-md5.c
index d38721a1010..3d17b2340fe 100644
--- a/contrib/pgcrypto/crypt-md5.c
+++ b/contrib/pgcrypto/crypt-md5.c
@@ -36,8 +36,8 @@ px_crypt_md5(const char *pw, const char *salt, char *passwd, unsigned dstlen)
     static char *magic = "$1$"; /* This string is magic for this algorithm.
                                  * Having it this way, we can get better later
                                  * on */
-    static char *p;
-    static const char *sp,
+    char *p;
+    const char *sp,
                *ep;
     unsigned char final[MD5_SIZE];
     int            sl,

I also find that FreeBSD removed this specifier in [2].
Should we remove this?

[1] https://www.postgresql.org/message-id/c763235a2757e2f5f9e3e27268b9028349cef659.camel%40oopsware.de
[2] https://reviews.freebsd.org/D7306
-- 
Regrads,
Japin Li

pgsql-hackers by date:

Previous
From: Tomas Vondra
Date:
Subject: Re: should we have a fast-path planning for OLTP starjoins?
Next
From: Daniel Gustafsson
Date:
Subject: Re: Remove unnecessary static specifier