[前][次][番号順一覧][スレッド一覧]

ruby-changes:48676

From: ko1 <ko1@a...>
Date: Thu, 16 Nov 2017 14:52:24 +0900 (JST)
Subject: [ruby-changes:48676] ko1:r60792 (trunk): `rb_source_loc` -> `rb_source_location_cstr`

ko1	2017-11-16 14:52:19 +0900 (Thu, 16 Nov 2017)

  New Revision: 60792

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=60792

  Log:
    `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.

  Modified files:
    trunk/error.c
    trunk/eval.c
    trunk/gc.c
    trunk/internal.h
    trunk/vm.c
Index: eval.c
===================================================================
--- eval.c	(revision 60791)
+++ eval.c	(revision 60792)
@@ -504,7 +504,7 @@ setup_exception(rb_execution_context_t * https://github.com/ruby/ruby/blob/trunk/eval.c#L504
     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;
 
Index: gc.c
===================================================================
--- gc.c	(revision 60791)
+++ gc.c	(revision 60792)
@@ -1874,7 +1874,7 @@ newobj_init(VALUE klass, VALUE flags, VA https://github.com/ruby/ruby/blob/trunk/gc.c#L1874
 #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
 
Index: error.c
===================================================================
--- error.c	(revision 60791)
+++ error.c	(revision 60792)
@@ -229,11 +229,9 @@ static VALUE https://github.com/ruby/ruby/blob/trunk/error.c#L229
 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, ...) https://github.com/ruby/ruby/blob/trunk/error.c#L531
     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 ch https://github.com/ruby/ruby/blob/trunk/error.c#L546
     int line = 0;
 
     if (GET_EC()) {
-	file = rb_source_loc(&line);
+	file = rb_source_location_cstr(&line);
     }
 
     report_bug(file, line, fmt, ctx);
Index: internal.h
===================================================================
--- internal.h	(revision 60791)
+++ internal.h	(revision 60792)
@@ -1767,7 +1767,7 @@ void rb_vm_change_state(void); https://github.com/ruby/ruby/blob/trunk/internal.h#L1767
 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 https://github.com/ruby/ruby/blob/trunk/internal.h#L1944
 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); \
     } \
Index: vm.c
===================================================================
--- vm.c	(revision 60791)
+++ vm.c	(revision 60792)
@@ -356,7 +356,7 @@ rb_dtrace_setup(rb_execution_context_t * https://github.com/ruby/ruby/blob/trunk/vm.c#L356
 	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 = "<unknown>";
 	    args->classname = classname;
@@ -1298,7 +1298,7 @@ rb_source_location(int *pline) https://github.com/ruby/ruby/blob/trunk/vm.c#L1298
 }
 
 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;

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]