Turn rb_sys_fail_on_write
into a function
This commit is contained in:
parent
452d51ffe1
commit
1a9a20cebd
12
io.c
12
io.c
@ -533,10 +533,12 @@ static rb_io_t *flush_before_seek(rb_io_t *fptr);
|
|||||||
|
|
||||||
extern ID ruby_static_id_signo;
|
extern ID ruby_static_id_signo;
|
||||||
|
|
||||||
NORETURN(static void raise_on_write(rb_io_t *fptr, int e, VALUE errinfo));
|
NORETURN(static void rb_sys_fail_on_write(rb_io_t *fptr));
|
||||||
static void
|
static void
|
||||||
raise_on_write(rb_io_t *fptr, int e, VALUE errinfo)
|
rb_sys_fail_on_write(rb_io_t *fptr)
|
||||||
{
|
{
|
||||||
|
int e = errno;
|
||||||
|
VALUE errinfo = rb_syserr_new_path(e, (fptr)->pathv);
|
||||||
#if defined EPIPE
|
#if defined EPIPE
|
||||||
if (fptr_signal_on_epipe(fptr) && (e == EPIPE)) {
|
if (fptr_signal_on_epipe(fptr) && (e == EPIPE)) {
|
||||||
const VALUE sig =
|
const VALUE sig =
|
||||||
@ -550,12 +552,6 @@ raise_on_write(rb_io_t *fptr, int e, VALUE errinfo)
|
|||||||
rb_exc_raise(errinfo);
|
rb_exc_raise(errinfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define rb_sys_fail_on_write(fptr) \
|
|
||||||
do { \
|
|
||||||
int e = errno; \
|
|
||||||
raise_on_write(fptr, e, rb_syserr_new_path(e, (fptr)->pathv)); \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define NEED_NEWLINE_DECORATOR_ON_READ(fptr) ((fptr)->mode & FMODE_TEXTMODE)
|
#define NEED_NEWLINE_DECORATOR_ON_READ(fptr) ((fptr)->mode & FMODE_TEXTMODE)
|
||||||
#define NEED_NEWLINE_DECORATOR_ON_WRITE(fptr) ((fptr)->mode & FMODE_TEXTMODE)
|
#define NEED_NEWLINE_DECORATOR_ON_WRITE(fptr) ((fptr)->mode & FMODE_TEXTMODE)
|
||||||
#if defined(RUBY_TEST_CRLF_ENVIRONMENT) || defined(_WIN32)
|
#if defined(RUBY_TEST_CRLF_ENVIRONMENT) || defined(_WIN32)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user