Skip to content

Commit 03a615d

Browse files
committed
Revert musl change to asctime.c. NFC
It looks like a patch from a more recent version of musl was applied in #12043. This change reverts that and removes the extra alias needed in in library.js. library.js now implements just a single `__asctime` which is used by both `asctime.c` and `asctime_r.c`. This is in the name doing more without musl matches and less in JS.
1 parent 9bb622f commit 03a615d

File tree

3 files changed

+17
-9
lines changed

3 files changed

+17
-9
lines changed

src/library.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -676,9 +676,10 @@ LibraryManager.library = {
676676
},
677677
__localtime_r: 'localtime_r',
678678

679-
asctime_r__deps: ['mktime'],
680-
asctime_r__sig: 'iii',
681-
asctime_r: function(tmPtr, buf) {
679+
// musl-internal function used to implement both `asctime` and `asctime_r`
680+
__asctime__deps: ['mktime'],
681+
__asctime__sig: 'iii',
682+
__asctime: function(tmPtr, buf) {
682683
var date = {
683684
tm_sec: {{{ makeGetValue('tmPtr', C_STRUCTS.tm.tm_sec, 'i32') }}},
684685
tm_min: {{{ makeGetValue('tmPtr', C_STRUCTS.tm.tm_min, 'i32') }}},
@@ -705,13 +706,12 @@ LibraryManager.library = {
705706
stringToUTF8(s, buf, 26);
706707
return buf;
707708
},
708-
__asctime_r: 'asctime_r',
709709

710-
ctime_r__deps: ['localtime_r', 'asctime_r'],
710+
ctime_r__deps: ['localtime_r', '__asctime'],
711711
ctime_r__sig: 'iii',
712712
ctime_r: function(time, buf) {
713713
var stack = stackSave();
714-
var rv = _asctime_r(_localtime_r(time, stackAlloc({{{ C_STRUCTS.tm.__size__ }}})), buf);
714+
var rv = ___asctime(_localtime_r(time, stackAlloc({{{ C_STRUCTS.tm.__size__ }}})), buf);
715715
stackRestore(stack);
716716
return rv;
717717
},
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#include <time.h>
22

3-
char *__asctime_r(const struct tm *, char *);
3+
char *__asctime(const struct tm *, char *);
44

55
char *asctime(const struct tm *tm)
66
{
77
static char buf[26];
8-
return __asctime_r(tm, buf);
8+
return __asctime(tm, buf);
99
}

tools/system_libs.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,15 @@ def get_files(self):
729729
# Allowed files from ignored modules
730730
libc_files += files_in_path(
731731
path_components=['system', 'lib', 'libc', 'musl', 'src', 'time'],
732-
filenames=['clock_settime.c', 'asctime.c', 'ctime.c', 'gmtime.c', 'localtime.c', 'nanosleep.c'])
732+
filenames=[
733+
'clock_settime.c',
734+
'asctime_r.c',
735+
'asctime.c',
736+
'ctime.c',
737+
'gmtime.c',
738+
'localtime.c',
739+
'nanosleep.c'
740+
])
733741
libc_files += files_in_path(
734742
path_components=['system', 'lib', 'libc', 'musl', 'src', 'legacy'],
735743
filenames=['getpagesize.c', 'err.c'])

0 commit comments

Comments
 (0)