file.c: rb_sys_fail_path_with_func
* file.c (rb_sys_fail_path_with_func): share same function, and path may be nil. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39760 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
bfd52c985c
commit
0d3d9eff4d
@ -1,3 +1,8 @@
|
|||||||
|
Fri Mar 15 14:51:33 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* file.c (rb_sys_fail_path_with_func): share same function, and path
|
||||||
|
may be nil.
|
||||||
|
|
||||||
Fri Mar 15 08:24:51 2013 NARUSE, Yui <naruse@ruby-lang.org>
|
Fri Mar 15 08:24:51 2013 NARUSE, Yui <naruse@ruby-lang.org>
|
||||||
|
|
||||||
* file.c (rb_sys_fail_path): define & use rb_sys_fail_path0 like r39752
|
* file.c (rb_sys_fail_path): define & use rb_sys_fail_path0 like r39752
|
||||||
|
2
dir.c
2
dir.c
@ -79,8 +79,6 @@ char *strchr(char*,char);
|
|||||||
#define opendir(p) rb_w32_uopendir(p)
|
#define opendir(p) rb_w32_uopendir(p)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define rb_sys_fail_path(path) rb_sys_fail_str(path)
|
|
||||||
|
|
||||||
#define FNM_NOESCAPE 0x01
|
#define FNM_NOESCAPE 0x01
|
||||||
#define FNM_PATHNAME 0x02
|
#define FNM_PATHNAME 0x02
|
||||||
#define FNM_DOTMATCH 0x04
|
#define FNM_DOTMATCH 0x04
|
||||||
|
17
file.c
17
file.c
@ -103,18 +103,19 @@ int flock(int, int);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef RUBY_FUNCTION_NAME_STRING
|
#ifdef RUBY_FUNCTION_NAME_STRING
|
||||||
# define rb_sys_fail_path(path) rb_sys_fail_path0(RUBY_FUNCTION_NAME_STRING, path)
|
void
|
||||||
NORETURN(static void rb_sys_fail_path0(const char *,VALUE));
|
rb_sys_fail_path_with_func(const char *func_name, VALUE path)
|
||||||
static void
|
|
||||||
rb_sys_fail_path0(const char *func_name, VALUE path)
|
|
||||||
{
|
{
|
||||||
VALUE mesg = rb_str_new_cstr(func_name);
|
VALUE mesg = rb_str_new_cstr(func_name);
|
||||||
rb_str_buf_cat2(mesg, ": ");
|
if (!NIL_P(path)) {
|
||||||
rb_str_buf_append(mesg, path);
|
/* RUBY_FUNCTION_NAME_STRING, aka __func__/__FUNCTION__ is not a
|
||||||
|
* preprocessor macro but a static constant array, so string
|
||||||
|
* literal concatenation is not allowed */
|
||||||
|
rb_str_buf_cat2(mesg, ": ");
|
||||||
|
rb_str_buf_append(mesg, path);
|
||||||
|
}
|
||||||
rb_sys_fail_str(mesg);
|
rb_sys_fail_str(mesg);
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
# define rb_sys_fail_path(path) rb_sys_fail_str(path)
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__BEOS__) || defined(__HAIKU__) /* should not change ID if -1 */
|
#if defined(__BEOS__) || defined(__HAIKU__) /* should not change ID if -1 */
|
||||||
|
@ -122,6 +122,13 @@ VALUE rb_get_path_check_to_string(VALUE, int);
|
|||||||
VALUE rb_get_path_check_convert(VALUE, VALUE, int);
|
VALUE rb_get_path_check_convert(VALUE, VALUE, int);
|
||||||
void Init_File(void);
|
void Init_File(void);
|
||||||
|
|
||||||
|
#ifdef RUBY_FUNCTION_NAME_STRING
|
||||||
|
NORETURN(void rb_sys_fail_path_with_func(const char *func_name, VALUE path));
|
||||||
|
# define rb_sys_fail_path(path) rb_sys_fail_path_with_func(RUBY_FUNCTION_NAME_STRING, path)
|
||||||
|
#else
|
||||||
|
# define rb_sys_fail_path(path) rb_sys_fail_str(path)
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
/* file.c, win32/file.c */
|
/* file.c, win32/file.c */
|
||||||
void rb_w32_init_file(void);
|
void rb_w32_init_file(void);
|
||||||
|
15
io.c
15
io.c
@ -399,21 +399,6 @@ rb_cloexec_fcntl_dupfd(int fd, int minfd)
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef RUBY_FUNCTION_NAME_STRING
|
|
||||||
# define rb_sys_fail_path(path) rb_sys_fail_path0(RUBY_FUNCTION_NAME_STRING, path)
|
|
||||||
NORETURN(static void rb_sys_fail_path0(const char *,VALUE));
|
|
||||||
static void
|
|
||||||
rb_sys_fail_path0(const char *func_name, VALUE path)
|
|
||||||
{
|
|
||||||
VALUE mesg = rb_str_new_cstr(func_name);
|
|
||||||
rb_str_buf_cat2(mesg, ": ");
|
|
||||||
rb_str_buf_append(mesg, path);
|
|
||||||
rb_sys_fail_str(mesg);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
# define rb_sys_fail_path(path) rb_sys_fail_str(path)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static int io_fflush(rb_io_t *);
|
static int io_fflush(rb_io_t *);
|
||||||
static rb_io_t *flush_before_seek(rb_io_t *fptr);
|
static rb_io_t *flush_before_seek(rb_io_t *fptr);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user