summaryrefslogtreecommitdiff
path: root/vm_trace.c
diff options
context:
space:
mode:
author卜部昌平 <shyouhei@ruby-lang.org>2020-06-22 12:28:30 +0900
committer卜部昌平 <shyouhei@ruby-lang.org>2020-06-29 11:05:41 +0900
commit2071c61e4216b5de347b327acd60fa1b4affeec2 (patch)
tree0234b386dc4d94a1fbbc5459f32c6b36352d9f63 /vm_trace.c
parent1bf0d3617172da9fe8b5e99796d8d85412c14f6a (diff)
tracepoint_inspect: do not goto into a branch
I'm not necessarily against every goto in general, but jumping into a branch is definitely a bad idea. Better refactor.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3247
Diffstat (limited to 'vm_trace.c')
-rw-r--r--vm_trace.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/vm_trace.c b/vm_trace.c
index 920a8d55ed..c02ad87f13 100644
--- a/vm_trace.c
+++ b/vm_trace.c
@@ -1455,7 +1455,7 @@ tracepoint_inspect(rb_execution_context_t *ec, VALUE self)
{
VALUE sym = rb_tracearg_method_id(trace_arg);
if (NIL_P(sym))
- goto default_inspect;
+ break;
return rb_sprintf("#<TracePoint:%"PRIsVALUE"@%"PRIsVALUE":%d in `%"PRIsVALUE"'>",
rb_tracearg_event(trace_arg),
rb_tracearg_path(trace_arg),
@@ -1477,12 +1477,12 @@ tracepoint_inspect(rb_execution_context_t *ec, VALUE self)
rb_tracearg_event(trace_arg),
rb_tracearg_self(trace_arg));
default:
- default_inspect:
- return rb_sprintf("#<TracePoint:%"PRIsVALUE"@%"PRIsVALUE":%d>",
- rb_tracearg_event(trace_arg),
- rb_tracearg_path(trace_arg),
- FIX2INT(rb_tracearg_lineno(trace_arg)));
+ break;
}
+ return rb_sprintf("#<TracePoint:%"PRIsVALUE"@%"PRIsVALUE":%d>",
+ rb_tracearg_event(trace_arg),
+ rb_tracearg_path(trace_arg),
+ FIX2INT(rb_tracearg_lineno(trace_arg)));
}
else {
return rb_sprintf("#<TracePoint:%s>", tp->tracing ? "enabled" : "disabled");