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

ruby-changes:22892

From: nobu <ko1@a...>
Date: Wed, 7 Mar 2012 12:26:44 +0900 (JST)
Subject: [ruby-changes:22892] nobu:r34941 (trunk): rb_load_fail

nobu	2012-03-07 12:26:30 +0900 (Wed, 07 Mar 2012)

  New Revision: 34941

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=34941

  Log:
    rb_load_fail
    * error.c (rb_load_fail): use path as a string, not char*.
    * internal.h: (rb_load_fail): moved from ruby/intern.h.
    * ruby.c (load_file_internal): fname cannot be NULL.

  Modified files:
    trunk/ChangeLog
    trunk/error.c
    trunk/include/ruby/intern.h
    trunk/internal.h
    trunk/ruby.c

Index: include/ruby/intern.h
===================================================================
--- include/ruby/intern.h	(revision 34940)
+++ include/ruby/intern.h	(revision 34941)
@@ -216,7 +216,6 @@
 PRINTF_ARGS(void rb_compile_error(const char*, int, const char*, ...), 3, 4);
 PRINTF_ARGS(void rb_compile_error_with_enc(const char*, int, void *, const char*, ...), 4, 5);
 PRINTF_ARGS(void rb_compile_error_append(const char*, ...), 1, 2);
-NORETURN(void rb_load_fail(const char*));
 NORETURN(void rb_error_frozen(const char*));
 void rb_error_untrusted(VALUE);
 void rb_check_frozen(VALUE);
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 34940)
+++ ChangeLog	(revision 34941)
@@ -1,3 +1,13 @@
+Wed Mar  7 12:26:25 2012  Nobuyoshi Nakada  <nobu@r...>
+
+	rb_load_fail
+
+	* error.c (rb_load_fail): use path as a string, not char*.
+
+	* internal.h: (rb_load_fail): moved from ruby/intern.h.
+
+	* ruby.c (load_file_internal): fname cannot be NULL.
+
 Wed Mar  7 08:32:43 2012  Aaron Patterson <aaron@t...>
 
 	* error.c (rb_loaderror_with_path): Adding the missing file as an
@@ -3,8 +13,8 @@
 	  instance variable to the LoadError exception.
 	  [ruby-core:39079]
-	
+
 	* load.c: call rb_loaderror_with_path so that the missing path is
 	  added to the exception.
-	
+
 	* ruby.c: call rb_loaderror rather than raising our own LoadError
 	  exception.
Index: error.c
===================================================================
--- error.c	(revision 34940)
+++ error.c	(revision 34941)
@@ -1908,9 +1908,9 @@
 }
 
 void
-rb_load_fail(const char *path)
+rb_load_fail(VALUE path)
 {
-    rb_loaderror_with_path(rb_str_new2(path), "%s -- %s", strerror(errno), path);
+    rb_loaderror_with_path(path, "%s -- %s", strerror(errno), RSTRING_PTR(path));
 }
 
 void
Index: internal.h
===================================================================
--- internal.h	(revision 34940)
+++ internal.h	(revision 34941)
@@ -116,6 +116,7 @@
 
 /* load.c */
 VALUE rb_get_load_path(void);
+NORETURN(void rb_load_fail(VALUE));
 
 /* math.c */
 VALUE rb_math_atan2(VALUE, VALUE);
Index: ruby.c
===================================================================
--- ruby.c	(revision 34940)
+++ ruby.c	(revision 34941)
@@ -1509,8 +1509,6 @@
     ID set_encoding;
     int xflag = 0;
 
-    if (!fname)
-	rb_load_fail(fname);
     if (strcmp(fname, "-") == 0) {
 	f = rb_stdin;
     }
@@ -1526,7 +1524,7 @@
 	}
 #endif
 	if ((fd = rb_cloexec_open(fname, mode, 0)) < 0) {
-	    rb_load_fail(fname);
+	    rb_load_fail(fname_v);
 	}
         rb_update_max_fd(fd);
 

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

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