Skip to content

Commit 05813cc

Browse files
committed
Run tool/lint.sh for C files in spec/ruby/optional/capi and fix formatting
1 parent d3a9d30 commit 05813cc

File tree

14 files changed

+54
-61
lines changed

14 files changed

+54
-61
lines changed

spec/ruby/optional/capi/ext/class_spec.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ static VALUE class_spec_rb_class_new_instance_kw(VALUE self, VALUE args, VALUE k
7272
#endif
7373

7474
static VALUE class_spec_rb_class_real(VALUE self, VALUE object) {
75-
if(rb_type_p(object, T_FIXNUM)) {
75+
if (rb_type_p(object, T_FIXNUM)) {
7676
return INT2FIX(rb_class_real(FIX2INT(object)));
7777
} else {
7878
return rb_class_real(CLASS_OF(object));
@@ -116,19 +116,19 @@ VALUE class_spec_define_attr(VALUE self, VALUE klass, VALUE sym, VALUE read, VAL
116116
}
117117

118118
static VALUE class_spec_rb_define_class(VALUE self, VALUE name, VALUE super) {
119-
if(NIL_P(super)) super = 0;
119+
if (NIL_P(super)) super = 0;
120120
return rb_define_class(RSTRING_PTR(name), super);
121121
}
122122

123123
static VALUE class_spec_rb_define_class_under(VALUE self, VALUE outer,
124124
VALUE name, VALUE super) {
125-
if(NIL_P(super)) super = 0;
125+
if (NIL_P(super)) super = 0;
126126
return rb_define_class_under(outer, RSTRING_PTR(name), super);
127127
}
128128

129129
static VALUE class_spec_rb_define_class_id_under(VALUE self, VALUE outer,
130130
VALUE name, VALUE super) {
131-
if(NIL_P(super)) super = 0;
131+
if (NIL_P(super)) super = 0;
132132
return rb_define_class_id_under(outer, SYM2ID(name), super);
133133
}
134134

spec/ruby/optional/capi/ext/debug_spec.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ static VALUE rb_debug_inspector_frame_iseq_get_callback(const rb_debug_inspector
4545
return rb_debug_inspector_frame_iseq_get(dc, NUM2LONG((VALUE) ptr));
4646
}
4747

48-
static VALUE debug_spec_callback_data(VALUE self){
48+
static VALUE debug_spec_callback_data(VALUE self) {
4949
return callback_data;
5050
}
5151

spec/ruby/optional/capi/ext/encoding_spec.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ static VALUE encoding_spec_MBCLEN_CHARFOUND_P(VALUE self, VALUE obj) {
1212
}
1313

1414
static VALUE encoding_spec_ENC_CODERANGE_ASCIIONLY(VALUE self, VALUE obj) {
15-
if(ENC_CODERANGE_ASCIIONLY(obj)) {
15+
if (ENC_CODERANGE_ASCIIONLY(obj)) {
1616
return Qtrue;
1717
} else {
1818
return Qfalse;
@@ -61,13 +61,13 @@ static VALUE encoding_spec_rb_filesystem_encindex(VALUE self) {
6161

6262
static VALUE encoding_spec_rb_default_internal_encoding(VALUE self) {
6363
rb_encoding* enc = rb_default_internal_encoding();
64-
if(enc == 0) return Qnil;
64+
if (enc == 0) return Qnil;
6565
return rb_str_new2(enc->name);
6666
}
6767

6868
static VALUE encoding_spec_rb_default_external_encoding(VALUE self) {
6969
rb_encoding* enc = rb_default_external_encoding();
70-
if(enc == 0) return Qnil;
70+
if (enc == 0) return Qnil;
7171
return rb_str_new2(enc->name);
7272
}
7373

@@ -86,7 +86,7 @@ static VALUE encoding_spec_rb_enc_associate_index(VALUE self, VALUE obj, VALUE i
8686
static VALUE encoding_spec_rb_enc_compatible(VALUE self, VALUE a, VALUE b) {
8787
rb_encoding* enc = rb_enc_compatible(a, b);
8888

89-
if(!enc) return INT2FIX(0);
89+
if (!enc) return INT2FIX(0);
9090

9191
return rb_enc_from_encoding(enc);
9292
}

spec/ruby/optional/capi/ext/exception_spec.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ VALUE exception_spec_rb_exc_new3(VALUE self, VALUE str) {
2727
}
2828

2929
VALUE exception_spec_rb_exc_raise(VALUE self, VALUE exc) {
30-
if (self != Qundef) rb_exc_raise(exc);
30+
if (self != Qundef) rb_exc_raise(exc);
3131
return Qnil;
3232
}
3333

spec/ruby/optional/capi/ext/gc_spec.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ static VALUE gc_spec_rb_gc(VALUE self) {
5151
return Qnil;
5252
}
5353

54-
static VALUE gc_spec_rb_gc_latest_gc_info(VALUE self, VALUE hash_or_key){
54+
static VALUE gc_spec_rb_gc_latest_gc_info(VALUE self, VALUE hash_or_key) {
5555
return rb_gc_latest_gc_info(hash_or_key);
5656
}
5757

spec/ruby/optional/capi/ext/integer_spec.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,15 @@ extern "C" {
66
#endif
77

88
static VALUE integer_spec_rb_integer_pack(VALUE self, VALUE value,
9-
VALUE words, VALUE numwords, VALUE wordsize, VALUE nails, VALUE flags)
10-
{
9+
VALUE words, VALUE numwords, VALUE wordsize, VALUE nails, VALUE flags) {
1110
int result = rb_integer_pack(value, (void*)RSTRING_PTR(words), FIX2INT(numwords),
1211
FIX2INT(wordsize), FIX2INT(nails), FIX2INT(flags));
1312
return INT2FIX(result);
1413
}
1514

1615
RUBY_EXTERN VALUE rb_int_positive_pow(long x, unsigned long y); /* internal.h, used in ripper */
1716

18-
static VALUE integer_spec_rb_int_positive_pow(VALUE self, VALUE a, VALUE b){
17+
static VALUE integer_spec_rb_int_positive_pow(VALUE self, VALUE a, VALUE b) {
1918
return rb_int_positive_pow(FIX2INT(a), FIX2INT(b));
2019
}
2120

spec/ruby/optional/capi/ext/io_spec.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ VALUE io_spec_rb_io_wait_readable(VALUE self, VALUE io, VALUE read_p) {
134134
rb_sys_fail("set_non_blocking failed");
135135

136136
#ifndef SET_NON_BLOCKING_FAILS_ALWAYS
137-
if(RTEST(read_p)) {
137+
if (RTEST(read_p)) {
138138
if (read(fd, buf, RB_IO_WAIT_READABLE_BUF) != -1) {
139139
return Qnil;
140140
}
@@ -145,7 +145,7 @@ VALUE io_spec_rb_io_wait_readable(VALUE self, VALUE io, VALUE read_p) {
145145

146146
ret = rb_io_wait_readable(fd);
147147

148-
if(RTEST(read_p)) {
148+
if (RTEST(read_p)) {
149149
ssize_t r = read(fd, buf, RB_IO_WAIT_READABLE_BUF);
150150
if (r != RB_IO_WAIT_READABLE_BUF) {
151151
perror("read");
@@ -185,7 +185,7 @@ VALUE io_spec_rb_io_maybe_wait_readable(VALUE self, VALUE error, VALUE io, VALUE
185185
rb_sys_fail("set_non_blocking failed");
186186

187187
#ifndef SET_NON_BLOCKING_FAILS_ALWAYS
188-
if(RTEST(read_p)) {
188+
if (RTEST(read_p)) {
189189
if (read(fd, buf, RB_IO_WAIT_READABLE_BUF) != -1) {
190190
return Qnil;
191191
}
@@ -197,7 +197,7 @@ VALUE io_spec_rb_io_maybe_wait_readable(VALUE self, VALUE error, VALUE io, VALUE
197197
// main part
198198
ret = rb_io_maybe_wait_readable(NUM2INT(error), io, timeout);
199199

200-
if(RTEST(read_p)) {
200+
if (RTEST(read_p)) {
201201
ssize_t r = read(fd, buf, RB_IO_WAIT_READABLE_BUF);
202202
if (r != RB_IO_WAIT_READABLE_BUF) {
203203
perror("read");

spec/ruby/optional/capi/ext/kernel_spec.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ static VALUE kernel_spec_rb_eval_string_protect(VALUE self, VALUE str, VALUE ary
220220

221221
VALUE kernel_spec_rb_sys_fail(VALUE self, VALUE msg) {
222222
errno = 1;
223-
if(msg == Qnil) {
223+
if (msg == Qnil) {
224224
rb_sys_fail(0);
225225
} else if (self != Qundef) {
226226
rb_sys_fail(StringValuePtr(msg));
@@ -229,7 +229,7 @@ VALUE kernel_spec_rb_sys_fail(VALUE self, VALUE msg) {
229229
}
230230

231231
VALUE kernel_spec_rb_syserr_fail(VALUE self, VALUE err, VALUE msg) {
232-
if(msg == Qnil) {
232+
if (msg == Qnil) {
233233
rb_syserr_fail(NUM2INT(err), NULL);
234234
} else if (self != Qundef) {
235235
rb_syserr_fail(NUM2INT(err), StringValuePtr(msg));
@@ -292,9 +292,9 @@ static VALUE kernel_spec_rb_yield_values2(VALUE self, VALUE ary) {
292292
}
293293

294294
static VALUE do_rec(VALUE obj, VALUE arg, int is_rec) {
295-
if(is_rec) {
295+
if (is_rec) {
296296
return obj;
297-
} else if(arg == Qtrue) {
297+
} else if (arg == Qtrue) {
298298
return rb_exec_recursive(do_rec, obj, Qnil);
299299
} else {
300300
return Qnil;

spec/ruby/optional/capi/ext/object_spec.c

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -218,126 +218,126 @@ static VALUE so_check_type(VALUE self, VALUE obj, VALUE other) {
218218
}
219219

220220
static VALUE so_is_type_nil(VALUE self, VALUE obj) {
221-
if(TYPE(obj) == T_NIL) {
221+
if (TYPE(obj) == T_NIL) {
222222
return Qtrue;
223223
}
224224
return Qfalse;
225225
}
226226

227227
static VALUE so_is_type_object(VALUE self, VALUE obj) {
228-
if(TYPE(obj) == T_OBJECT) {
228+
if (TYPE(obj) == T_OBJECT) {
229229
return Qtrue;
230230
}
231231
return Qfalse;
232232
}
233233

234234
static VALUE so_is_type_array(VALUE self, VALUE obj) {
235-
if(TYPE(obj) == T_ARRAY) {
235+
if (TYPE(obj) == T_ARRAY) {
236236
return Qtrue;
237237
}
238238
return Qfalse;
239239
}
240240

241241
static VALUE so_is_type_module(VALUE self, VALUE obj) {
242-
if(TYPE(obj) == T_MODULE) {
242+
if (TYPE(obj) == T_MODULE) {
243243
return Qtrue;
244244
}
245245
return Qfalse;
246246
}
247247

248248
static VALUE so_is_type_class(VALUE self, VALUE obj) {
249-
if(TYPE(obj) == T_CLASS) {
249+
if (TYPE(obj) == T_CLASS) {
250250
return Qtrue;
251251
}
252252
return Qfalse;
253253
}
254254

255255
static VALUE so_is_type_data(VALUE self, VALUE obj) {
256-
if(TYPE(obj) == T_DATA) {
256+
if (TYPE(obj) == T_DATA) {
257257
return Qtrue;
258258
}
259259
return Qfalse;
260260
}
261261

262262
static VALUE so_is_rb_type_p_nil(VALUE self, VALUE obj) {
263-
if(rb_type_p(obj, T_NIL)) {
263+
if (rb_type_p(obj, T_NIL)) {
264264
return Qtrue;
265265
}
266266
return Qfalse;
267267
}
268268

269269
static VALUE so_is_rb_type_p_object(VALUE self, VALUE obj) {
270-
if(rb_type_p(obj, T_OBJECT)) {
270+
if (rb_type_p(obj, T_OBJECT)) {
271271
return Qtrue;
272272
}
273273
return Qfalse;
274274
}
275275

276276
static VALUE so_is_rb_type_p_array(VALUE self, VALUE obj) {
277-
if(rb_type_p(obj, T_ARRAY)) {
277+
if (rb_type_p(obj, T_ARRAY)) {
278278
return Qtrue;
279279
}
280280
return Qfalse;
281281
}
282282

283283
static VALUE so_is_rb_type_p_module(VALUE self, VALUE obj) {
284-
if(rb_type_p(obj, T_MODULE)) {
284+
if (rb_type_p(obj, T_MODULE)) {
285285
return Qtrue;
286286
}
287287
return Qfalse;
288288
}
289289

290290
static VALUE so_is_rb_type_p_class(VALUE self, VALUE obj) {
291-
if(rb_type_p(obj, T_CLASS)) {
291+
if (rb_type_p(obj, T_CLASS)) {
292292
return Qtrue;
293293
}
294294
return Qfalse;
295295
}
296296

297297
static VALUE so_is_rb_type_p_data(VALUE self, VALUE obj) {
298-
if(rb_type_p(obj, T_DATA)) {
298+
if (rb_type_p(obj, T_DATA)) {
299299
return Qtrue;
300300
}
301301
return Qfalse;
302302
}
303303

304304
static VALUE so_is_rb_type_p_file(VALUE self, VALUE obj) {
305-
if(rb_type_p(obj, T_FILE)) {
305+
if (rb_type_p(obj, T_FILE)) {
306306
return Qtrue;
307307
}
308308
return Qfalse;
309309
}
310310

311311
static VALUE so_is_builtin_type_object(VALUE self, VALUE obj) {
312-
if(BUILTIN_TYPE(obj) == T_OBJECT) {
312+
if (BUILTIN_TYPE(obj) == T_OBJECT) {
313313
return Qtrue;
314314
}
315315
return Qfalse;
316316
}
317317

318318
static VALUE so_is_builtin_type_array(VALUE self, VALUE obj) {
319-
if(BUILTIN_TYPE(obj) == T_ARRAY) {
319+
if (BUILTIN_TYPE(obj) == T_ARRAY) {
320320
return Qtrue;
321321
}
322322
return Qfalse;
323323
}
324324

325325
static VALUE so_is_builtin_type_module(VALUE self, VALUE obj) {
326-
if(BUILTIN_TYPE(obj) == T_MODULE) {
326+
if (BUILTIN_TYPE(obj) == T_MODULE) {
327327
return Qtrue;
328328
}
329329
return Qfalse;
330330
}
331331

332332
static VALUE so_is_builtin_type_class(VALUE self, VALUE obj) {
333-
if(BUILTIN_TYPE(obj) == T_CLASS) {
333+
if (BUILTIN_TYPE(obj) == T_CLASS) {
334334
return Qtrue;
335335
}
336336
return Qfalse;
337337
}
338338

339339
static VALUE so_is_builtin_type_data(VALUE self, VALUE obj) {
340-
if(BUILTIN_TYPE(obj) == T_DATA) {
340+
if (BUILTIN_TYPE(obj) == T_DATA) {
341341
return Qtrue;
342342
}
343343
return Qfalse;

spec/ruby/optional/capi/ext/range_spec.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ extern "C" {
77

88
VALUE range_spec_rb_range_new(int argc, VALUE* argv, VALUE self) {
99
int exclude_end = 0;
10-
if(argc == 3) {
10+
if (argc == 3) {
1111
exclude_end = RTEST(argv[2]);
1212
}
1313
return rb_range_new(argv[0], argv[1], exclude_end);

0 commit comments

Comments
 (0)