Index | Thread | Search

From:
enh <enh@google.com>
Subject:
strptime: move constants to rodata
To:
OpenBSD Tech <tech@openbsd.org>
Date:
Tue, 26 Aug 2025 16:22:34 -0400

Download raw body.

Thread
this is one of Android's three diffs -- i'm about to send the others
too -- but sadly it's the one with no explanation of what caused me to
carry this diff (given that i don't think we have any decent tooling
for finding things that should be declared `const`)...

diff --git a/lib/libc/time/strptime.c b/lib/libc/time/strptime.c
index 2fae1f49220..b5dd81349bc 100644
--- a/lib/libc/time/strptime.c
+++ b/lib/libc/time/strptime.c
@@ -59,8 +59,8 @@
 #define FIELD_TM_YDAY (1 << 3)
 #define FIELD_TM_YEAR (1 << 4)

-static char gmt[] = { "GMT" };
-static char utc[] = { "UTC" };
+static char const gmt[] = { "GMT" };
+static char const utc[] = { "UTC" };
 /* RFC-822/RFC-2822 */
 static const char * const nast[5] = {
        "EST",    "CST",    "MST",    "PST",    "\0\0\0"