* io.c: parenthesize macro arguments.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30227 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2010-12-16 12:53:09 +00:00
Родитель f18d040061
Коммит e5ad455a08
2 изменённых файлов: 16 добавлений и 12 удалений

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

@ -1,3 +1,7 @@
Thu Dec 16 21:52:07 2010 Tanaka Akira <akr@fsij.org>
* io.c: parenthesize macro arguments.
Thu Dec 16 21:46:39 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
* tool/mkconfig.rb (RbConfig): honor ARCHFLAGS and RC_ARCHS to

24
io.c
Просмотреть файл

@ -173,7 +173,7 @@ static int max_file_descriptor = NOFILE;
#elif defined(FILE_READEND)
# define STDIO_READ_DATA_PENDING(fp) ((fp)->FILE_READPTR < (fp)->FILE_READEND)
#elif defined(__BEOS__) || defined(__HAIKU__)
# define STDIO_READ_DATA_PENDING(fp) (fp->_state._eof == 0)
# define STDIO_READ_DATA_PENDING(fp) ((fp)->_state._eof == 0)
#else
# define STDIO_READ_DATA_PENDING(fp) (!feof(fp))
#endif
@ -208,10 +208,10 @@ static int max_file_descriptor = NOFILE;
# define S_ISSOCK(m) _S_ISSOCK(m)
# else
# ifdef _S_IFSOCK
# define S_ISSOCK(m) ((m & S_IFMT) == _S_IFSOCK)
# define S_ISSOCK(m) (((m) & S_IFMT) == _S_IFSOCK)
# else
# ifdef S_IFSOCK
# define S_ISSOCK(m) ((m & S_IFMT) == S_IFSOCK)
# define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
# endif
# endif
# endif
@ -219,16 +219,16 @@ static int max_file_descriptor = NOFILE;
#if defined(RUBY_TEST_CRLF_ENVIRONMENT) || defined(_WIN32)
/* Windows */
# define NEED_NEWLINE_DECORATOR_ON_READ(fptr) (!(fptr->mode & FMODE_BINMODE))
# define NEED_NEWLINE_DECORATOR_ON_WRITE(fptr) (!(fptr->mode & FMODE_BINMODE))
# define NEED_NEWLINE_DECORATOR_ON_READ(fptr) (!((fptr)->mode & FMODE_BINMODE))
# define NEED_NEWLINE_DECORATOR_ON_WRITE(fptr) (!((fptr)->mode & FMODE_BINMODE))
# define TEXTMODE_NEWLINE_DECORATOR_ON_WRITE ECONV_CRLF_NEWLINE_DECORATOR
#else
/* Unix */
# 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) 0
#endif
#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_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)))
#if !defined HAVE_SHUTDOWN && !defined shutdown
#define shutdown(a,b) 0
@ -413,7 +413,7 @@ flush_before_seek(rb_io_t *fptr)
return fptr;
}
#define io_seek(fptr, ofs, whence) (errno = 0, lseek(flush_before_seek(fptr)->fd, ofs, whence))
#define io_seek(fptr, ofs, whence) (errno = 0, lseek(flush_before_seek(fptr)->fd, (ofs), (whence)))
#define io_tell(fptr) lseek(flush_before_seek(fptr)->fd, 0, SEEK_CUR)
#ifndef SEEK_CUR
@ -545,7 +545,7 @@ io_alloc(VALUE klass)
}
#ifndef S_ISREG
# define S_ISREG(m) ((m & S_IFMT) == S_IFREG)
# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
#endif
static int
@ -6782,11 +6782,11 @@ argf_forward(int argc, VALUE *argv, VALUE argf)
(ARGF.current_file == rb_stdin && TYPE(ARGF.current_file) != T_FILE)
#define ARGF_FORWARD(argc, argv) do {\
if (ARGF_GENERIC_INPUT_P())\
return argf_forward(argc, argv, argf);\
return argf_forward((argc), (argv), argf);\
} while (0)
#define NEXT_ARGF_FORWARD(argc, argv) do {\
if (!next_argv()) return Qnil;\
ARGF_FORWARD(argc, argv);\
ARGF_FORWARD((argc), (argv));\
} while (0)
static void