Skip to content

Commit f5dd861

Browse files
Apply clang-format
1 parent 0e8afc0 commit f5dd861

File tree

2 files changed

+20
-15
lines changed

2 files changed

+20
-15
lines changed

ext/js/js-core.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
// MARK: - Ruby extension
88

99
#ifndef RBOOL
10-
#define RBOOL(v) ((v) ? Qtrue : Qfalse)
10+
# define RBOOL(v) ((v) ? Qtrue : Qfalse)
1111
#endif
1212

1313
extern VALUE rb_mKernel;
@@ -65,7 +65,8 @@ static struct jsvalue *check_jsvalue(VALUE obj) {
6565

6666
#define IS_JSVALUE(obj) (rb_typeddata_is_kind_of((obj), &jsvalue_data_type))
6767

68-
static inline void rstring_to_abi_string(VALUE rstr, rb_js_abi_host_string_t *abi_str) {
68+
static inline void rstring_to_abi_string(VALUE rstr,
69+
rb_js_abi_host_string_t *abi_str) {
6970
abi_str->len = RSTRING_LEN(rstr);
7071
abi_str->ptr = xmalloc(abi_str->len);
7172
memcpy(abi_str->ptr, RSTRING_PTR(rstr), abi_str->len);

ext/witapi/witapi-core.c

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ void *rb_wasm_handle_fiber_unwind(void (**new_fiber_entry)(void *, void *),
2323
#define RB_WASM_ENABLE_DEBUG_LOG 0
2424

2525
#if RB_WASM_ENABLE_DEBUG_LOG
26-
# define RB_WASM_DEBUG_LOG(...) fprintf(stderr, __VA_ARGS__)
26+
# define RB_WASM_DEBUG_LOG(...) fprintf(stderr, __VA_ARGS__)
2727
#else
28-
# define RB_WASM_DEBUG_LOG(...) (void)0
28+
# define RB_WASM_DEBUG_LOG(...) (void)0
2929
#endif
3030

3131
#define RB_WASM_LIB_RT(MAIN_ENTRY) \
@@ -85,7 +85,8 @@ static VALUE rb_abi_lend_object_internal(VALUE obj) {
8585
rb_hash_aset(rb_abi_guest_arena_hash, object_id, obj);
8686
rb_hash_aset(rb_abi_guest_refcount_hash, object_id, INT2FIX(1));
8787
} else {
88-
rb_hash_aset(rb_abi_guest_refcount_hash, object_id, INT2FIX(FIX2INT(ref_count) + 1));
88+
rb_hash_aset(rb_abi_guest_refcount_hash, object_id,
89+
INT2FIX(FIX2INT(ref_count) + 1));
8990
}
9091
return Qundef;
9192
}
@@ -108,16 +109,19 @@ static VALUE rb_abi_guest_rb_abi_value_dtor_internal(VALUE obj) {
108109
rb_hash_delete(rb_abi_guest_refcount_hash, object_id);
109110
rb_hash_delete(rb_abi_guest_arena_hash, object_id);
110111
} else {
111-
RB_WASM_DEBUG_LOG("rb_abi_guest_rb_abi_value_dtor: ref_count = %d\n", FIX2INT(ref_count));
112-
rb_hash_aset(rb_abi_guest_refcount_hash, object_id, INT2FIX(FIX2INT(ref_count) - 1));
112+
RB_WASM_DEBUG_LOG("rb_abi_guest_rb_abi_value_dtor: ref_count = %d\n",
113+
FIX2INT(ref_count));
114+
rb_hash_aset(rb_abi_guest_refcount_hash, object_id,
115+
INT2FIX(FIX2INT(ref_count) - 1));
113116
}
114117
return Qundef;
115118
}
116119

117120
void rb_abi_guest_rb_abi_value_dtor(void *data) {
118121
RB_WASM_DEBUG_LOG("rb_abi_guest_rb_abi_value_dtor: data = %p\n", data);
119122
int state;
120-
RB_WASM_LIB_RT(rb_protect(rb_abi_guest_rb_abi_value_dtor_internal, (VALUE)data, &state));
123+
RB_WASM_LIB_RT(
124+
rb_protect(rb_abi_guest_rb_abi_value_dtor_internal, (VALUE)data, &state));
121125
assert(state == TAG_NONE && "rb_abi_guest_rb_abi_value_dtor_internal failed");
122126
}
123127

@@ -175,7 +179,8 @@ void rb_abi_guest_rb_eval_string_protect(rb_abi_guest_string_t *str,
175179
VALUE retval;
176180
RB_WASM_DEBUG_LOG("rb_eval_string_protect: str = %s\n", str->ptr);
177181
RB_WASM_LIB_RT(retval = rb_eval_string_protect(str->ptr, state));
178-
RB_WASM_DEBUG_LOG("rb_eval_string_protect: retval = %p, state = %d\n", (void *)retval, *state);
182+
RB_WASM_DEBUG_LOG("rb_eval_string_protect: retval = %p, state = %d\n",
183+
(void *)retval, *state);
179184

180185
if (*state == TAG_NONE) {
181186
rb_abi_lend_object(retval);
@@ -205,10 +210,11 @@ void rb_abi_guest_rb_funcallv_protect(rb_abi_guest_rb_abi_value_t recv,
205210
int32_t *ret1) {
206211
VALUE retval;
207212
VALUE r_recv = (VALUE)rb_abi_guest_rb_abi_value_get(&recv);
208-
struct rb_funcallv_thunk_ctx ctx = {
209-
.recv = r_recv, .mid = mid, .args = args};
213+
struct rb_funcallv_thunk_ctx ctx = {.recv = r_recv, .mid = mid, .args = args};
210214
RB_WASM_LIB_RT(retval = rb_protect(rb_funcallv_thunk, (VALUE)&ctx, ret1));
211-
RB_WASM_DEBUG_LOG("rb_abi_guest_rb_funcallv_protect: retval = %p, state = %d\n", (void *)retval, *ret1);
215+
RB_WASM_DEBUG_LOG(
216+
"rb_abi_guest_rb_funcallv_protect: retval = %p, state = %d\n",
217+
(void *)retval, *ret1);
212218

213219
if (*ret1 == TAG_NONE) {
214220
rb_abi_lend_object(retval);
@@ -227,9 +233,7 @@ rb_abi_guest_rb_abi_value_t rb_abi_guest_rb_errinfo(void) {
227233
return rb_abi_guest_rb_abi_value_new((void *)retval);
228234
}
229235

230-
void rb_abi_guest_rb_clear_errinfo(void) {
231-
rb_set_errinfo(Qnil);
232-
}
236+
void rb_abi_guest_rb_clear_errinfo(void) { rb_set_errinfo(Qnil); }
233237

234238
void rb_abi_guest_rstring_ptr(rb_abi_guest_rb_abi_value_t value,
235239
rb_abi_guest_string_t *ret0) {

0 commit comments

Comments
 (0)