mirror of
git://git.musl-libc.org/musl
synced 2025-03-06 20:48:29 +01:00
__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.
This commit is contained in:
parent
c5459df188
commit
2d84486a08
1 changed files with 2 additions and 2 deletions
|
@ -10,9 +10,9 @@ long long __year_to_secs(long long year, int *is_leap)
|
|||
return 31536000*(y-70) + 86400*leaps;
|
||||
}
|
||||
|
||||
int cycles, centuries, leaps, rem;
|
||||
int cycles, centuries, leaps, rem, dummy;
|
||||
|
||||
if (!is_leap) is_leap = &(int){0};
|
||||
if (!is_leap) is_leap = &dummy;
|
||||
cycles = (year-100) / 400;
|
||||
rem = (year-100) % 400;
|
||||
if (rem < 0) {
|
||||
|
|
Loading…
Add table
Reference in a new issue