libroot/musl: __year_to_secs: fix dangling pointer

The lifetime of the compound literal ends after the "if" statement's
implicit block. gcc also warns about this.

Change-Id: I408d77638ab82c5305bfcd31affb2b14070652f4
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9699
Reviewed-by: Adrien Destugues <[email protected]>
Tested-by: Commit checker robot <[email protected]>
This commit is contained in:
Alex Xu (Hello71)
2025-10-16 02:13:26 +00:00
committed by waddlesplash
parent 832ccec747
commit 5f4a1d9171
@@ -11,12 +11,9 @@ long long __year_to_secs(long long year, int *is_leap)
}
{
int cycles, centuries, leaps, rem;
int cycles, centuries, leaps, rem, dummy;
if (!is_leap) {
static int isleap = 0;
is_leap = &isleap;
}
if (!is_leap) is_leap = &dummy;
cycles = (year-100) / 400;
rem = (year-100) % 400;
if (rem < 0) {