ruby-changes:56050
From: Nobuyoshi <ko1@a...>
Date: Sat, 8 Jun 2019 18:55:48 +0900 (JST)
Subject: [ruby-changes:56050] Nobuyoshi Nakada: 21de4a574f (trunk): io.c: fold very very long lines
https://git.ruby-lang.org/ruby.git/commit/?id=21de4a574f From 21de4a574f363e77c64d36ce2671fa55e7955b49 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Sat, 8 Jun 2019 18:44:04 +0900 Subject: io.c: fold very very long lines diff --git a/io.c b/io.c index 32e3a39..cec16ea 100644 --- a/io.c +++ b/io.c @@ -498,7 +498,14 @@ static rb_io_t *flush_before_seek(rb_io_t *fptr); https://github.com/ruby/ruby/blob/trunk/io.c#L498 * conversion IO process and universal newline decorator by default. */ #define NEED_READCONV(fptr) ((fptr)->encs.enc2 != NULL || (fptr)->encs.ecflags & ~ECONV_CRLF_NEWLINE_DECORATOR) -#define NEED_WRITECONV(fptr) (((fptr)->encs.enc != NULL && (fptr)->encs.enc != rb_ascii8bit_encoding()) || ((fptr)->encs.ecflags & ((ECONV_DECORATOR_MASK & ~ECONV_CRLF_NEWLINE_DECORATOR)|ECONV_STATEFUL_DECORATOR_MASK))) +#define WRITECONV_MASK ( \ + (ECONV_DECORATOR_MASK & ~ECONV_CRLF_NEWLINE_DECORATOR)|\ + ECONV_STATEFUL_DECORATOR_MASK|\ + 0) +#define NEED_WRITECONV(fptr) ( \ + ((fptr)->encs.enc != NULL && (fptr)->encs.enc != rb_ascii8bit_encoding()) || \ + ((fptr)->encs.ecflags & WRITECONV_MASK) || \ + 0) #define SET_BINARY_MODE(fptr) setmode((fptr)->fd, O_BINARY) #define NEED_NEWLINE_DECORATOR_ON_READ_CHECK(fptr) do {\ @@ -626,7 +633,11 @@ set_binary_mode_with_seek_cur(rb_io_t *fptr) https://github.com/ruby/ruby/blob/trunk/io.c#L633 /* Unix */ # define DEFAULT_TEXTMODE 0 #define NEED_READCONV(fptr) ((fptr)->encs.enc2 != NULL || NEED_NEWLINE_DECORATOR_ON_READ(fptr)) -#define NEED_WRITECONV(fptr) (((fptr)->encs.enc != NULL && (fptr)->encs.enc != rb_ascii8bit_encoding()) || NEED_NEWLINE_DECORATOR_ON_WRITE(fptr) || ((fptr)->encs.ecflags & (ECONV_DECORATOR_MASK|ECONV_STATEFUL_DECORATOR_MASK))) +#define NEED_WRITECONV(fptr) ( \ + ((fptr)->encs.enc != NULL && (fptr)->encs.enc != rb_ascii8bit_encoding()) || \ + NEED_NEWLINE_DECORATOR_ON_WRITE(fptr) || \ + ((fptr)->encs.ecflags & (ECONV_DECORATOR_MASK|ECONV_STATEFUL_DECORATOR_MASK)) || \ + 0) #define SET_BINARY_MODE(fptr) (void)(fptr) #define NEED_NEWLINE_DECORATOR_ON_READ_CHECK(fptr) (void)(fptr) #define SET_UNIVERSAL_NEWLINE_DECORATOR_IF_ENC2(enc2, ecflags) ((void)(enc2), (void)(ecflags)) @@ -2905,11 +2916,15 @@ io_getpartial(int argc, VALUE *argv, VALUE io, VALUE opts, int nonblock) https://github.com/ruby/ruby/blob/trunk/io.c#L2916 * * Note that readpartial behaves similar to sysread. * The differences are: - * * If the byte buffer is not empty, read from the byte buffer instead of "sysread for buffered IO (IOError)". - * * It doesn't cause Errno::EWOULDBLOCK and Errno::EINTR. When readpartial meets EWOULDBLOCK and EINTR by read system call, readpartial retry the system call. + * * If the byte buffer is not empty, read from the byte buffer + * instead of "sysread for buffered IO (IOError)". + * * It doesn't cause Errno::EWOULDBLOCK and Errno::EINTR. When + * readpartial meets EWOULDBLOCK and EINTR by read system call, + * readpartial retry the system call. * * The latter means that readpartial is nonblocking-flag insensitive. - * It blocks on the situation IO#sysread causes Errno::EWOULDBLOCK as if the fd is blocking mode. + * It blocks on the situation IO#sysread causes Errno::EWOULDBLOCK as + * if the fd is blocking mode. * */ -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/