* 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
This commit is contained in:
nobu 2012-03-07 03:26:30 +00:00
Родитель 293249fba4
Коммит 72de92d1f9
5 изменённых файлов: 16 добавлений и 8 удалений

Просмотреть файл

@ -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.

Просмотреть файл

@ -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

Просмотреть файл

@ -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);

Просмотреть файл

@ -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);

4
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);