Remove obsolete cast
authorPeter Eisentraut <peter@eisentraut.org>
Thu, 20 Nov 2025 06:47:48 +0000 (07:47 +0100)
committerPeter Eisentraut <peter@eisentraut.org>
Thu, 20 Nov 2025 06:47:48 +0000 (07:47 +0100)
The upstream timezone code uses a bool variable as an array subscript.
Back when PostgreSQL's bool was char, this would have caused a warning
from gcc -Wchar-subscripts, which is included in -Wall.  But this has
been obsolete since probably commit d26a810ebf9, but certainly since
bool is now the C standard bool.  So we can remove this deviation from
the upstream code, to make future code merges simpler.

Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://www.postgresql.org/message-id/flat/9ad2749f-77ab-4ecb-a321-1ca915480b05%40eisentraut.org

src/timezone/localtime.c

index 8eb02ef14691cb3b06161f1ea6415d33c3b5d4e8..450d54ffd494da77d89152530c03987cf8e22191 100644 (file)
@@ -905,7 +905,7 @@ transtime(const int year, const struct rule *const rulep,
            for (i = 1; i < rulep->r_week; ++i)
            {
                if (d + DAYSPERWEEK >=
-                   mon_lengths[(int) leapyear][rulep->r_mon - 1])
+                   mon_lengths[leapyear][rulep->r_mon - 1])
                    break;
                d += DAYSPERWEEK;
            }
@@ -915,7 +915,7 @@ transtime(const int year, const struct rule *const rulep,
             */
            value = d * SECSPERDAY;
            for (i = 0; i < rulep->r_mon - 1; ++i)
-               value += mon_lengths[(int) leapyear][i] * SECSPERDAY;
+               value += mon_lengths[leapyear][i] * SECSPERDAY;
            break;
    }