Skip to content

Commit 8624b5c

Browse files
pinotreechqrlie
authored andcommitted
Use ftello() & fseeko() on any OS based on GNU libc
Strictly speaking, they are available in POSIX.1-2008 [1][2], so they could be used on more platforms/OSes. To be cautious, enable them when using GNU libc, since they have been available with that libc for a very long time. [1] https://pubs.opengroup.org/onlinepubs/9699919799/functions/ftell.html [2] https://pubs.opengroup.org/onlinepubs/9699919799/functions/fseek.html
1 parent 3489493 commit 8624b5c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

quickjs-libc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1090,7 +1090,7 @@ static JSValue js_std_file_tell(JSContext *ctx, JSValueConst this_val,
10901090
int64_t pos;
10911091
if (!f)
10921092
return JS_EXCEPTION;
1093-
#if defined(__linux__)
1093+
#if defined(__linux__) || defined(__GLIBC__)
10941094
pos = ftello(f);
10951095
#else
10961096
pos = ftell(f);
@@ -1113,7 +1113,7 @@ static JSValue js_std_file_seek(JSContext *ctx, JSValueConst this_val,
11131113
return JS_EXCEPTION;
11141114
if (JS_ToInt32(ctx, &whence, argv[1]))
11151115
return JS_EXCEPTION;
1116-
#if defined(__linux__)
1116+
#if defined(__linux__) || defined(__GLIBC__)
11171117
ret = fseeko(f, pos, whence);
11181118
#else
11191119
ret = fseek(f, pos, whence);

0 commit comments

Comments
 (0)