From 82dad2181ac045646b636f32b1c72556b76bd498 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Mon, 13 Jan 2025 16:33:52 +0100 Subject: [PATCH] fixup: more! --- quickjs-libc.c | 2 +- quickjs.c | 90 +++++++++++++++++++++++++------------------------- unicode_gen.c | 4 +-- 3 files changed, 48 insertions(+), 48 deletions(-) diff --git a/quickjs-libc.c b/quickjs-libc.c index a93d5d871..742dc7eb3 100644 --- a/quickjs-libc.c +++ b/quickjs-libc.c @@ -123,7 +123,7 @@ typedef struct { typedef struct { struct list_head link; int64_t timer_id; - uint8_t repeats:1; + bool repeats; int64_t timeout; int64_t delay; JSValue func; diff --git a/quickjs.c b/quickjs.c index 697211ce2..0292674aa 100644 --- a/quickjs.c +++ b/quickjs.c @@ -327,7 +327,7 @@ typedef struct JSStackFrame { uint8_t *cur_pc; /* only used in bytecode functions : PC of the instruction after the call */ uint32_t arg_count : 31; - uint32_t is_strict_mode : 1; + bool is_strict_mode; /* only used in generators. Current stack pointer value. NULL if the function is running. */ JSValue *cur_sp; @@ -361,12 +361,12 @@ typedef struct JSVarRef { int __gc_ref_count; /* corresponds to header.ref_count */ uint8_t __gc_mark; /* corresponds to header.mark/gc_obj_type */ - /* 0 : the JSVarRef is on the stack. header.link is an element + /* false : the JSVarRef is on the stack. header.link is an element of JSStackFrame.var_ref_list. - 1 : the JSVarRef is detached. header.link has the normal meanning + true : the JSVarRef is detached. header.link has the normal meanning */ - uint8_t is_detached : 1; - uint8_t is_arg : 1; + bool is_detached; + bool is_arg; uint16_t var_idx; /* index of the corresponding function variable on the stack */ }; @@ -491,7 +491,7 @@ typedef enum { struct JSString { JSRefCountHeader header; /* must come first, 32-bit */ uint32_t len : 31; - uint8_t is_wide_char : 1; /* 0 = 8 bits, 1 = 16 bits characters */ + bool is_wide_char; /* false = 8 bits, true = 16 bits characters */ /* for JS_ATOM_TYPE_SYMBOL: hash = 0, atom_type = 3, for JS_ATOM_TYPE_PRIVATE: hash = 1, atom_type = 3 XXX: could change encoding to have one more bit in hash */ @@ -509,10 +509,10 @@ struct JSString { }; typedef struct JSClosureVar { - uint8_t is_local : 1; - uint8_t is_arg : 1; - uint8_t is_const : 1; - uint8_t is_lexical : 1; + bool is_local; + bool is_arg; + bool is_const; + bool is_lexical; uint8_t var_kind : 4; /* see JSVarKindEnum */ /* 8 bits available */ uint16_t var_idx; /* is_local = true: index to a normal variable of the @@ -559,10 +559,10 @@ typedef struct JSVarDef { variable in the same or enclosing lexical scope */ int scope_next; - uint8_t is_const : 1; - uint8_t is_lexical : 1; - uint8_t is_captured : 1; - uint8_t is_static_private : 1; /* only used during private class field parsing */ + bool is_const; + bool is_lexical; + bool is_captured; + bool is_static_private; /* only used during private class field parsing */ uint8_t var_kind : 4; /* see JSVarKindEnum */ /* only used during compilation: function pool index for lexical variables with var_kind = @@ -662,18 +662,18 @@ static force_inline JSAtom get_ic_atom(JSInlineCache *ic, uint32_t cache_offset) typedef struct JSFunctionBytecode { JSGCObjectHeader header; /* must come first */ - uint8_t is_strict_mode : 1; - uint8_t has_prototype : 1; /* true if a prototype field is necessary */ - uint8_t has_simple_parameter_list : 1; - uint8_t is_derived_class_constructor : 1; + bool is_strict_mode; + bool has_prototype; /* true if a prototype field is necessary */ + bool has_simple_parameter_list; + bool is_derived_class_constructor; /* true if home_object needs to be initialized */ - uint8_t need_home_object : 1; + bool need_home_object; uint8_t func_kind : 2; - uint8_t new_target_allowed : 1; - uint8_t super_call_allowed : 1; - uint8_t super_allowed : 1; - uint8_t arguments_allowed : 1; - uint8_t backtrace_barrier : 1; /* stop backtrace on this function */ + bool new_target_allowed; + bool super_call_allowed; + bool super_allowed; + bool arguments_allowed; + bool backtrace_barrier; /* stop backtrace on this function */ /* XXX: 5 bits available */ uint8_t *byte_code_buf; /* (self pointer) */ int byte_code_len; @@ -933,14 +933,14 @@ struct JSObject { int __gc_ref_count; /* corresponds to header.ref_count */ uint8_t __gc_mark; /* corresponds to header.mark/gc_obj_type */ - uint8_t extensible : 1; - uint8_t free_mark : 1; /* only used when freeing objects with cycles */ - uint8_t is_exotic : 1; /* true if object has exotic property handlers */ - uint8_t fast_array : 1; /* true if u.array is used for get/put (for JS_CLASS_ARRAY, JS_CLASS_ARGUMENTS and typed arrays) */ - uint8_t is_constructor : 1; /* true if object is a constructor function */ - uint8_t is_uncatchable_error : 1; /* if true, error is not catchable */ - uint8_t tmp_mark : 1; /* used in JS_WriteObjectRec() */ - uint8_t is_HTMLDDA : 1; /* specific annex B IsHtmlDDA behavior */ + bool extensible; + bool free_mark; /* only used when freeing objects with cycles */ + bool is_exotic; /* true if object has exotic property handlers */ + bool fast_array; /* true if u.array is used for get/put (for JS_CLASS_ARRAY, JS_CLASS_ARGUMENTS and typed arrays) */ + bool is_constructor; /* true if object is a constructor function */ + bool is_uncatchable_error; /* if true, error is not catchable */ + bool tmp_mark; /* used in JS_WriteObjectRec() */ + bool is_HTMLDDA; /* specific annex B IsHtmlDDA behavior */ uint16_t class_id; /* see JS_CLASS_x */ }; }; @@ -18680,18 +18680,18 @@ typedef struct BlockEnv { int drop_count; /* number of stack elements to drop */ int label_finally; /* -1 if none */ int scope_level; - uint8_t has_iterator : 1; - uint8_t is_regular_stmt : 1; // i.e. not a loop statement + bool has_iterator; + bool is_regular_stmt; // i.e. not a loop statement } BlockEnv; typedef struct JSGlobalVar { - int cpool_idx; /* if >= 0, index in the constant pool for hoisted - function defintion*/ - uint8_t force_init : 1; /* force initialization to undefined */ - uint8_t is_lexical : 1; /* global let/const definition */ - uint8_t is_const : 1; /* const definition */ - int scope_level; /* scope of definition */ - JSAtom var_name; /* variable name */ + int cpool_idx; /* if >= 0, index in the constant pool for hoisted + function defintion*/ + bool force_init; /* force initialization to undefined */ + bool is_lexical; /* global let/const definition */ + bool is_const; /* const definition */ + int scope_level; /* scope of definition */ + JSAtom var_name; /* variable name */ } JSGlobalVar; typedef struct RelocEntry { @@ -18774,7 +18774,7 @@ typedef struct JSFunctionDef { bool backtrace_barrier; JSFunctionKindEnum func_kind : 8; JSParseFunctionEnum func_type : 7; - uint8_t is_strict_mode : 1; + bool is_strict_mode; JSAtom func_name; /* JS_ATOM_NULL if no name */ JSVarDef *vars; @@ -40266,8 +40266,8 @@ typedef struct JSIteratorHelperData { JSValue inner; // innerValue (flatMap) int64_t count; // limit (drop, take) or counter (filter, map, flatMap) JSIteratorHelperKindEnum kind : 8; - uint8_t executing : 1; - uint8_t done : 1; + bool executing; + bool done; } JSIteratorHelperData; static JSValue js_create_iterator_helper(JSContext *ctx, JSValue this_val, @@ -40904,7 +40904,7 @@ static JSValue js_iterator_helper_next(JSContext *ctx, JSValue this_val, } done: - it->done = magic == GEN_MAGIC_NEXT ? *pdone : 1; + it->done = magic == GEN_MAGIC_NEXT ? *pdone : true; it->executing = 0; return ret; fail: diff --git a/unicode_gen.c b/unicode_gen.c index cb46fbc96..3e9a87c25 100644 --- a/unicode_gen.c +++ b/unicode_gen.c @@ -230,8 +230,8 @@ typedef struct { int f_data[CC_LEN_MAX]; /* to case folding */ uint8_t combining_class; - uint8_t is_compat:1; - uint8_t is_excluded:1; + bool is_compat; + bool is_excluded; uint8_t general_category; uint8_t script; uint8_t script_ext_len;