mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-30 08:18:30 +00:00
Fix bugs in cosmocc toolchain
This change integrates e58abc1110b335a3341e8ad5821ad8e3880d9bb2 from https://github.com/ahgamut/musl-cross-make/ which fixes the issues we were having with our C language extension for symbolic constants. This change also performs some code cleanup and bug fixes to getaddrinfo(). It's now possible to compile projects like ncurses, readline and python without needing to patch anything upstream, except maybe a line or two. Pretty soon it should be possible to build a Linux distro on Cosmo.
This commit is contained in:
parent
22f81a8d50
commit
23e235b7a5
272 changed files with 3491 additions and 4350 deletions
|
@ -1441,6 +1441,20 @@ tzset(void)
|
|||
localtime_unlock();
|
||||
}
|
||||
|
||||
static void
|
||||
gmtcheck(void)
|
||||
{
|
||||
static bool gmt_is_set;
|
||||
localtime_lock();
|
||||
if (! gmt_is_set) {
|
||||
gmtptr = malloc(sizeof *gmtptr);
|
||||
if (gmtptr)
|
||||
gmtload(gmtptr);
|
||||
gmt_is_set = true;
|
||||
}
|
||||
localtime_unlock();
|
||||
}
|
||||
|
||||
static void
|
||||
FreeGmt(void *p) {
|
||||
free(p);
|
||||
|
@ -2180,6 +2194,29 @@ mktime(struct tm *tmp)
|
|||
return t;
|
||||
}
|
||||
|
||||
time_t
|
||||
timelocal(struct tm *tmp)
|
||||
{
|
||||
if (tmp != NULL)
|
||||
tmp->tm_isdst = -1; /* in case it wasn't initialized */
|
||||
return mktime(tmp);
|
||||
}
|
||||
|
||||
time_t
|
||||
timegm(struct tm *tmp)
|
||||
{
|
||||
return timeoff(tmp, 0);
|
||||
}
|
||||
|
||||
time_t
|
||||
timeoff(struct tm *tmp, long offset)
|
||||
{
|
||||
if (tmp)
|
||||
tmp->tm_isdst = 0;
|
||||
gmtcheck();
|
||||
return localtime_time1(tmp, gmtsub, gmtptr, offset);
|
||||
}
|
||||
|
||||
static int_fast32_t
|
||||
leapcorr(struct state const *sp, time_t t)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue