diff --git a/array.c b/array.c index 2454b99d76..7edbd54a30 100644 --- a/array.c +++ b/array.c @@ -379,7 +379,7 @@ ary_alloc(VALUE klass) static VALUE empty_ary_alloc(VALUE klass) { - if(RUBY_DTRACE_ARRAY_CREATE_ENABLED()) { + if (RUBY_DTRACE_ARRAY_CREATE_ENABLED()) { RUBY_DTRACE_ARRAY_CREATE(0, rb_sourcefile(), rb_sourceline()); } @@ -398,7 +398,7 @@ ary_new(VALUE klass, long capa) rb_raise(rb_eArgError, "array size too big"); } - if(RUBY_DTRACE_ARRAY_CREATE_ENABLED()) { + if (RUBY_DTRACE_ARRAY_CREATE_ENABLED()) { RUBY_DTRACE_ARRAY_CREATE(capa, rb_sourcefile(), rb_sourceline()); } @@ -5042,7 +5042,7 @@ rb_ary_product(int argc, VALUE *argv, VALUE ary) } /* put it on the result array */ - if(NIL_P(result)) { + if (NIL_P(result)) { FL_SET(t0, FL_USER5); rb_yield(subarray); if (! FL_TEST(t0, FL_USER5)) { diff --git a/dln.c b/dln.c index ed107551c7..e6b20d54e3 100644 --- a/dln.c +++ b/dln.c @@ -767,7 +767,7 @@ load_1(int fd, long disp, const char *need_init) unsigned int mask = 0; #endif - if(rel >= rel_beg) + if (rel >= rel_beg) address += hdr.a_text; if (rel->r_extern) { /* Look it up in symbol-table */ @@ -1429,7 +1429,7 @@ dln_load(const char *file) NSLinkModule(obj_file, file, NSLINKMODULE_OPTION_BINDNOW); /* lookup the initial function */ - if(!NSIsSymbolNameDefined(buf)) { + if (!NSIsSymbolNameDefined(buf)) { dln_loaderror("Failed to lookup Init function %.200s",file); } init_fct = NSAddressOfSymbol(NSLookupAndBindSymbol(buf)); diff --git a/encoding.c b/encoding.c index b9e820fa29..c94dc90a7e 100644 --- a/encoding.c +++ b/encoding.c @@ -1487,7 +1487,7 @@ rb_locale_charmap(VALUE klass) # endif if (!codeset) { UINT codepage = GetConsoleCP(); - if(!codepage) codepage = GetACP(); + if (!codepage) codepage = GetACP(); snprintf(cp, sizeof(cp), "CP%d", codepage); codeset = cp; } diff --git a/enum.c b/enum.c index aa8b64a995..9cce3e260d 100644 --- a/enum.c +++ b/enum.c @@ -2490,7 +2490,7 @@ enum_chunk(int argc, VALUE *argv, VALUE enumerable) VALUE initial_state; VALUE enumerator; - if(!rb_block_given_p()) + if (!rb_block_given_p()) rb_raise(rb_eArgError, "no block given"); rb_scan_args(argc, argv, "01", &initial_state); diff --git a/enumerator.c b/enumerator.c index 8f6ac76abf..335b8c8c1e 100644 --- a/enumerator.c +++ b/enumerator.c @@ -1003,7 +1003,7 @@ enumerator_size(VALUE obj) return (*e->size_fn)(e->obj, e->args); } if (rb_obj_is_proc(e->size)) { - if(e->args) + if (e->args) return rb_proc_call(e->size, e->args); else return rb_proc_call_with_block(e->size, 0, 0, Qnil); diff --git a/eval.c b/eval.c index cbf49f3011..bcc461e3e4 100644 --- a/eval.c +++ b/eval.c @@ -503,10 +503,10 @@ setup_exception(rb_thread_t *th, int tag, volatile VALUE mesg) } if (tag != TAG_FATAL) { - if(RUBY_DTRACE_RAISE_ENABLED()) { + if (RUBY_DTRACE_RAISE_ENABLED()) { RUBY_DTRACE_RAISE(rb_obj_classname(th->errinfo), - rb_sourcefile(), - rb_sourceline()); + rb_sourcefile(), + rb_sourceline()); } EXEC_EVENT_HOOK(th, RUBY_EVENT_RAISE, th->cfp->self, 0, 0, mesg); } diff --git a/hash.c b/hash.c index a9047be968..68955b241c 100644 --- a/hash.c +++ b/hash.c @@ -219,7 +219,7 @@ hash_alloc(VALUE klass) static VALUE empty_hash_alloc(VALUE klass) { - if(RUBY_DTRACE_HASH_CREATE_ENABLED()) { + if (RUBY_DTRACE_HASH_CREATE_ENABLED()) { RUBY_DTRACE_HASH_CREATE(0, rb_sourcefile(), rb_sourceline()); } diff --git a/load.c b/load.c index 98a5900b5b..f973394087 100644 --- a/load.c +++ b/load.c @@ -623,11 +623,10 @@ rb_f_load(int argc, VALUE *argv) rb_scan_args(argc, argv, "11", &fname, &wrap); - if(RUBY_DTRACE_LOAD_ENTRY_ENABLED()) { - RUBY_DTRACE_LOAD_ENTRY( - StringValuePtr(fname), - rb_sourcefile(), - rb_sourceline()); + if (RUBY_DTRACE_LOAD_ENTRY_ENABLED()) { + RUBY_DTRACE_LOAD_ENTRY(StringValuePtr(fname), + rb_sourcefile(), + rb_sourceline()); } path = rb_find_file(FilePathValue(fname)); @@ -638,8 +637,8 @@ rb_f_load(int argc, VALUE *argv) } rb_load_internal(path, RTEST(wrap)); - if(RUBY_DTRACE_LOAD_RETURN_ENABLED()) { - RUBY_DTRACE_LOAD_RETURN(StringValuePtr(fname)); + if (RUBY_DTRACE_LOAD_RETURN_ENABLED()) { + RUBY_DTRACE_LOAD_RETURN(StringValuePtr(fname)); } return Qtrue; @@ -875,11 +874,10 @@ rb_require_safe(VALUE fname, int safe) } volatile saved; char *volatile ftptr = 0; - if(RUBY_DTRACE_REQUIRE_ENTRY_ENABLED()) { - RUBY_DTRACE_REQUIRE_ENTRY( - StringValuePtr(fname), - rb_sourcefile(), - rb_sourceline()); + if (RUBY_DTRACE_REQUIRE_ENTRY_ENABLED()) { + RUBY_DTRACE_REQUIRE_ENTRY(StringValuePtr(fname), + rb_sourcefile(), + rb_sourceline()); } PUSH_TAG(); @@ -893,20 +891,18 @@ rb_require_safe(VALUE fname, int safe) FilePathValue(fname); rb_set_safe_level_force(0); - if(RUBY_DTRACE_FIND_REQUIRE_ENTRY_ENABLED()) { - RUBY_DTRACE_FIND_REQUIRE_ENTRY( - StringValuePtr(fname), - rb_sourcefile(), - rb_sourceline()); + if (RUBY_DTRACE_FIND_REQUIRE_ENTRY_ENABLED()) { + RUBY_DTRACE_FIND_REQUIRE_ENTRY(StringValuePtr(fname), + rb_sourcefile(), + rb_sourceline()); } found = search_required(fname, &path, safe); - if(RUBY_DTRACE_FIND_REQUIRE_RETURN_ENABLED()) { - RUBY_DTRACE_FIND_REQUIRE_RETURN( - StringValuePtr(fname), - rb_sourcefile(), - rb_sourceline()); + if (RUBY_DTRACE_FIND_REQUIRE_RETURN_ENABLED()) { + RUBY_DTRACE_FIND_REQUIRE_RETURN(StringValuePtr(fname), + rb_sourcefile(), + rb_sourceline()); } if (found) { if (!path || !(ftptr = load_lock(RSTRING_PTR(path)))) { @@ -943,8 +939,8 @@ rb_require_safe(VALUE fname, int safe) th->errinfo = errinfo; - if(RUBY_DTRACE_REQUIRE_RETURN_ENABLED()) { - RUBY_DTRACE_REQUIRE_RETURN(StringValuePtr(fname)); + if (RUBY_DTRACE_REQUIRE_RETURN_ENABLED()) { + RUBY_DTRACE_REQUIRE_RETURN(StringValuePtr(fname)); } return result; diff --git a/numeric.c b/numeric.c index 278d27f489..7912c6278c 100644 --- a/numeric.c +++ b/numeric.c @@ -850,7 +850,7 @@ flodivmod(double x, double y, double *divp, double *modp) double div, mod; if (y == 0.0) rb_num_zerodiv(); - if((x == 0.0) || (isinf(y) && !isinf(x))) + if ((x == 0.0) || (isinf(y) && !isinf(x))) mod = x; else { #ifdef HAVE_FMOD diff --git a/probes_helper.h b/probes_helper.h index 13bcbdbbda..91514b31ea 100644 --- a/probes_helper.h +++ b/probes_helper.h @@ -23,7 +23,7 @@ VALUE rb_class_path_no_cache(VALUE _klass); else if (FL_TEST(_klass, FL_SINGLETON)) { \ _klass = rb_iv_get(_klass, "__attached__"); \ } \ - switch(TYPE(_klass)) { \ + switch (TYPE(_klass)) { \ case T_CLASS: \ case T_ICLASS: \ case T_MODULE: \ @@ -31,7 +31,8 @@ VALUE rb_class_path_no_cache(VALUE _klass); VALUE _name = rb_class_path_no_cache(_klass); \ if (!NIL_P(_name)) { \ classname = StringValuePtr(_name); \ - } else { \ + } \ + else { \ classname = ""; \ } \ methodname = rb_id2name(_id); \ diff --git a/signal.c b/signal.c index f419d45845..0d41fada5a 100644 --- a/signal.c +++ b/signal.c @@ -394,7 +394,7 @@ rb_f_kill(int argc, VALUE *argv) } if (strncmp("SIG", s, 3) == 0) s += 3; - if((sig = signm2signo(s)) == 0) + if ((sig = signm2signo(s)) == 0) rb_raise(rb_eArgError, "unsupported name `SIG%s'", s); if (negative) diff --git a/string.c b/string.c index f2ee280a75..46661769e6 100644 --- a/string.c +++ b/string.c @@ -385,7 +385,7 @@ str_alloc(VALUE klass) static inline VALUE empty_str_alloc(VALUE klass) { - if(RUBY_DTRACE_STRING_CREATE_ENABLED()) { + if (RUBY_DTRACE_STRING_CREATE_ENABLED()) { RUBY_DTRACE_STRING_CREATE(0, rb_sourcefile(), rb_sourceline()); } return str_alloc(klass); @@ -400,7 +400,7 @@ str_new(VALUE klass, const char *ptr, long len) rb_raise(rb_eArgError, "negative string size (or size too big)"); } - if(RUBY_DTRACE_STRING_CREATE_ENABLED()) { + if (RUBY_DTRACE_STRING_CREATE_ENABLED()) { RUBY_DTRACE_STRING_CREATE(len, rb_sourcefile(), rb_sourceline()); } @@ -932,9 +932,9 @@ rb_str_dup(VALUE str) VALUE rb_str_resurrect(VALUE str) { - if(RUBY_DTRACE_STRING_CREATE_ENABLED()) { - RUBY_DTRACE_STRING_CREATE( - RSTRING_LEN(str), rb_sourcefile(), rb_sourceline()); + if (RUBY_DTRACE_STRING_CREATE_ENABLED()) { + RUBY_DTRACE_STRING_CREATE(RSTRING_LEN(str), + rb_sourcefile(), rb_sourceline()); } return str_replace(str_alloc(rb_cString), str); } diff --git a/vm.c b/vm.c index f14d3915c3..d39fe02e0c 100644 --- a/vm.c +++ b/vm.c @@ -1986,7 +1986,7 @@ m_core_hash_from_ary(VALUE self, VALUE ary) VALUE hash = rb_hash_new(); int i; - if(RUBY_DTRACE_HASH_CREATE_ENABLED()) { + if (RUBY_DTRACE_HASH_CREATE_ENABLED()) { RUBY_DTRACE_HASH_CREATE(RARRAY_LEN(ary), rb_sourcefile(), rb_sourceline()); } diff --git a/vm_trace.c b/vm_trace.c index e2919ff79e..cfe8d9e83a 100644 --- a/vm_trace.c +++ b/vm_trace.c @@ -1082,7 +1082,7 @@ tracepoint_new(VALUE klass, rb_thread_t *target_th, rb_event_flag_t events, void VALUE rb_tracepoint_new(VALUE target_thread, rb_event_flag_t events, void (*func)(VALUE, void *), void *data) { - rb_thread_t *target_th = 0; + rb_thread_t *target_th = GET_THREAD(); if (RTEST(target_thread)) { /* TODO: now unsupported */ }