1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

[meson] SIZEOF_INTPTR_T

This commit is contained in:
Witold Filipczyk 2024-08-23 22:21:11 +02:00
parent 081efa66d9
commit 1ab0dab2fc
3 changed files with 38 additions and 9 deletions

View File

@ -821,6 +821,9 @@
/* The size of `short', as computed by sizeof. */
#define SIZEOF_SHORT @SIZEOF_SHORT@
/* The size of `intptr_t`, as computed by sizeof. */
#define SIZEOF_INTPTR_T @SIZEOF_INTPTR_T@
/* If using the C implementation of alloca, define if you know the
direction of stack growth for your system; otherwise it will be
automatically deduced at runtime.

View File

@ -1148,6 +1148,7 @@ conf_data.set('SIZEOF_INT', compiler.sizeof('int'))
conf_data.set('SIZEOF_LONG', compiler.sizeof('long'))
conf_data.set('SIZEOF_LONG_LONG', compiler.sizeof('long long'))
conf_data.set('SIZEOF_OFF_T', compiler.sizeof('off_t'))
conf_data.set('SIZEOF_INTPTR_T', compiler.sizeof('intptr_t', prefix: '#include <stdint.h>'))
conf_data.set('CONFIG_GNUTLS_OPENSSL_COMPAT', false)

View File

@ -273,7 +273,11 @@ js_window_setInterval(JSContext *ctx, JSValueConst this_val, int argc, JSValueCo
if (JS_IsFunction(ctx, func)) {
struct ecmascript_timeout *id = ecmascript_set_timeout2q(ctx, func, timeout, timeout);
return JS_NewInt64(ctx, (int64_t)(id));
#if SIZEOF_UINTPTR_T == 4
return JS_NewInt32(ctx, (intptr_t)(id));
#else
return JS_NewInt64(ctx, (intptr_t)(id));
#endif
}
if (JS_IsString(func)) {
@ -288,7 +292,11 @@ js_window_setInterval(JSContext *ctx, JSValueConst this_val, int argc, JSValueCo
if (code2) {
struct ecmascript_timeout *id = ecmascript_set_timeout(ctx, code2, timeout, timeout);
return JS_NewInt64(ctx, (int64_t)(id));
#if SIZEOF_UINTPTR_T == 4
return JS_NewInt32(ctx, (intptr_t)(id));
#else
return JS_NewInt64(ctx, (intptr_t)(id));
#endif
}
}
@ -325,8 +333,11 @@ js_window_setTimeout(JSContext *ctx, JSValueConst this_val, int argc, JSValueCon
if (JS_IsFunction(ctx, func)) {
struct ecmascript_timeout *id = ecmascript_set_timeout2q(ctx, func, timeout, -1);
return JS_NewInt64(ctx, (int64_t)(id));
#if SIZEOF_UINTPTR_T == 4
return JS_NewInt32(ctx, (intptr_t)(id));
#else
return JS_NewInt64(ctx, (intptr_t)(id));
#endif
}
if (JS_IsString(func)) {
@ -340,8 +351,11 @@ js_window_setTimeout(JSContext *ctx, JSValueConst this_val, int argc, JSValueCon
if (code2) {
struct ecmascript_timeout *id = ecmascript_set_timeout(ctx, code2, timeout, -1);
return JS_NewInt64(ctx, (int64_t)(id));
#if SIZEOF_UINTPTR_T == 4
return JS_NewInt32(ctx, (intptr_t)(id));
#else
return JS_NewInt64(ctx, (intptr_t)(id));
#endif
}
}
@ -360,12 +374,17 @@ js_window_clearInterval(JSContext *ctx, JSValueConst this_val, int argc, JSValue
if (argc != 1) {
return JS_UNDEFINED;
}
int64_t number;
intptr_t number;
#if SIZEOF_UINTPTR_T == 4
if (JS_ToInt32(ctx, &number, argv[0])) {
return JS_UNDEFINED;
}
#else
if (JS_ToInt64(ctx, &number, argv[0])) {
return JS_UNDEFINED;
}
#endif
struct ecmascript_timeout *t = (struct ecmascript_timeout *)(number);
if (t && found_in_map_timer(t->tid)) {
@ -391,11 +410,17 @@ js_window_clearTimeout(JSContext *ctx, JSValueConst this_val, int argc, JSValueC
if (argc != 1) {
return JS_UNDEFINED;
}
int64_t number;
intptr_t number;
#if SIZEOF_UINTPTR_T == 4
if (JS_ToInt32(ctx, &number, argv[0])) {
return JS_UNDEFINED;
}
#else
if (JS_ToInt64(ctx, &number, argv[0])) {
return JS_UNDEFINED;
}
#endif
struct ecmascript_timeout *t = (struct ecmascript_timeout *)(number);
if (t && found_in_map_timer(t->tid)) {