From 360b78e4dccf19971d7dc46a31fc55a2759e8762 Mon Sep 17 00:00:00 2001 From: ko1 Date: Thu, 16 Nov 2017 05:52:19 +0000 Subject: [PATCH] `rb_source_loc` -> `rb_source_location_cstr` * vm.c (rb_source_loc): rename to rb_source_location_cstr() to make behavior clear compare with rb_source_location(). * error.c (warning_string): use rb_source_location_cstr() directly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60792 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- error.c | 10 ++++------ eval.c | 2 +- gc.c | 2 +- internal.h | 4 ++-- vm.c | 4 ++-- 5 files changed, 10 insertions(+), 12 deletions(-) diff --git a/error.c b/error.c index 420539e4a4..eff64848cb 100644 --- a/error.c +++ b/error.c @@ -229,11 +229,9 @@ static VALUE warning_string(rb_encoding *enc, const char *fmt, va_list args) { int line; - VALUE file = rb_source_location(&line); - + const char *file = rb_source_location_cstr(&line); return warn_vsprintf(enc, - NIL_P(file) ? NULL : RSTRING_PTR(file), line, - fmt, args); + RSTRING_PTR(file), line, fmt, args); } #define with_warning_string(mesg, enc, fmt) \ @@ -533,7 +531,7 @@ rb_bug(const char *fmt, ...) int line = 0; if (GET_EC()) { - file = rb_source_loc(&line); + file = rb_source_location_cstr(&line); } report_bug(file, line, fmt, NULL); @@ -548,7 +546,7 @@ rb_bug_context(const void *ctx, const char *fmt, ...) int line = 0; if (GET_EC()) { - file = rb_source_loc(&line); + file = rb_source_location_cstr(&line); } report_bug(file, line, fmt, ctx); diff --git a/eval.c b/eval.c index 582a605f9b..5b578ed28b 100644 --- a/eval.c +++ b/eval.c @@ -504,7 +504,7 @@ setup_exception(rb_execution_context_t *ec, int tag, volatile VALUE mesg, VALUE const char *file = 0; int line; - file = rb_source_loc(&line); + file = rb_source_location_cstr(&line); if ((file && !NIL_P(mesg)) || (cause != Qundef)) { volatile int state = 0; diff --git a/gc.c b/gc.c index c1bcdd2c75..527827efc4 100644 --- a/gc.c +++ b/gc.c @@ -1874,7 +1874,7 @@ newobj_init(VALUE klass, VALUE flags, VALUE v1, VALUE v2, VALUE v3, int wb_prote #endif #if GC_DEBUG - RANY(obj)->file = rb_source_loc(&RANY(obj)->line); + RANY(obj)->file = rb_source_location_cstr(&RANY(obj)->line); GC_ASSERT(!SPECIAL_CONST_P(obj)); /* check alignment */ #endif diff --git a/internal.h b/internal.h index 7f8d95f64a..9d33ed99d1 100644 --- a/internal.h +++ b/internal.h @@ -1767,7 +1767,7 @@ void rb_vm_change_state(void); void rb_vm_inc_const_missing_count(void); const void **rb_vm_get_insns_address_table(void); VALUE rb_source_location(int *pline); -const char *rb_source_loc(int *pline); +const char *rb_source_location_cstr(int *pline); void rb_vm_pop_cfunc_frame(void); int rb_vm_add_root_module(ID id, VALUE module); void rb_vm_check_redefinition_by_prepend(VALUE klass); @@ -1944,7 +1944,7 @@ RUBY_SYMBOL_EXPORT_END do { \ if (UNLIKELY(RUBY_DTRACE_##name##_ENABLED())) { \ int dtrace_line; \ - const char *dtrace_file = rb_source_loc(&dtrace_line); \ + const char *dtrace_file = rb_source_location_cstr(&dtrace_line); \ if (!dtrace_file) dtrace_file = ""; \ RUBY_DTRACE_##name(arg, dtrace_file, dtrace_line); \ } \ diff --git a/vm.c b/vm.c index 96cbe39877..7d6bcba0c2 100644 --- a/vm.c +++ b/vm.c @@ -356,7 +356,7 @@ rb_dtrace_setup(rb_execution_context_t *ec, VALUE klass, ID id, VALUE name = rb_class_path_no_cache(klass); const char *classname, *filename; const char *methodname = rb_id2name(id); - if (methodname && (filename = rb_source_loc(&args->line_no)) != 0) { + if (methodname && (filename = rb_source_location_cstr(&args->line_no)) != 0) { if (NIL_P(name) || !(classname = StringValuePtr(name))) classname = ""; args->classname = classname; @@ -1298,7 +1298,7 @@ rb_source_location(int *pline) } const char * -rb_source_loc(int *pline) +rb_source_location_cstr(int *pline) { VALUE path = rb_source_location(pline); if (NIL_P(path)) return NULL;