summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-03-07 03:26:30 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-03-07 03:26:30 +0000
commit72de92d1f9f7ad5861f151f972db085cdf3e0edb (patch)
treebba75ce2e5907ca0c425d1e2421cbbc9d2b65a50
parent293249fba4c149e690c28c1ee41f9056173682a6 (diff)
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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34941 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog14
-rw-r--r--error.c4
-rw-r--r--include/ruby/intern.h1
-rw-r--r--internal.h1
-rw-r--r--ruby.c4
5 files changed, 16 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index 4d7e33417a..34371c4d92 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,12 +1,22 @@
+Wed Mar 7 12:26:25 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ 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@tenderlovemaking.com>
* error.c (rb_loaderror_with_path): Adding the missing file as an
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.
diff --git a/error.c b/error.c
index e0c6a44b2f..b8f9f06654 100644
--- a/error.c
+++ b/error.c
@@ -1908,9 +1908,9 @@ rb_sys_warning(const char *fmt, ...)
}
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
diff --git a/include/ruby/intern.h b/include/ruby/intern.h
index 42f9e48c55..7c5d79d7b3 100644
--- a/include/ruby/intern.h
+++ b/include/ruby/intern.h
@@ -216,7 +216,6 @@ NORETURN(void rb_invalid_str(const char*, const char*));
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);
diff --git a/internal.h b/internal.h
index cf274ac223..e25062bc2f 100644
--- a/internal.h
+++ b/internal.h
@@ -116,6 +116,7 @@ VALUE rb_iseq_clone(VALUE iseqval, VALUE newcbase);
/* load.c */
VALUE rb_get_load_path(void);
+NORETURN(void rb_load_fail(VALUE));
/* math.c */
VALUE rb_math_atan2(VALUE, VALUE);
diff --git a/ruby.c b/ruby.c
index 16e66c8f9c..c0e3b030e2 100644
--- a/ruby.c
+++ b/ruby.c
@@ -1509,8 +1509,6 @@ load_file_internal(VALUE arg)
ID set_encoding;
int xflag = 0;
- if (!fname)
- rb_load_fail(fname);
if (strcmp(fname, "-") == 0) {
f = rb_stdin;
}
@@ -1526,7 +1524,7 @@ load_file_internal(VALUE arg)
}
#endif
if ((fd = rb_cloexec_open(fname, mode, 0)) < 0) {
- rb_load_fail(fname);
+ rb_load_fail(fname_v);
}
rb_update_max_fd(fd);