* file.c: parenthesize macro arguments.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30191 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2010-12-13 03:01:12 +00:00
Родитель b36c91b6b5
Коммит 53360bd50a
2 изменённых файлов: 26 добавлений и 22 удалений

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

@ -1,3 +1,7 @@
Mon Dec 13 12:00:09 2010 Tanaka Akira <akr@fsij.org>
* file.c: parenthesize macro arguments.
Mon Dec 13 11:21:14 2010 NARUSE, Yui <naruse@ruby-lang.org>
* io.c (simple_sendfile): added for BSD version of sendfile(2).

44
file.c
Просмотреть файл

@ -72,25 +72,25 @@ int flock(int, int);
/* define system APIs */
#ifdef _WIN32
#define STAT(p, s) rb_w32_ustati64(p, s)
#define STAT(p, s) rb_w32_ustati64((p), (s))
#undef lstat
#define lstat(p, s) rb_w32_ustati64(p, s)
#define lstat(p, s) rb_w32_ustati64((p), (s))
#undef access
#define access(p, m) rb_w32_uaccess(p, m)
#define access(p, m) rb_w32_uaccess((p), (m))
#undef chmod
#define chmod(p, m) rb_w32_uchmod(p, m)
#define chmod(p, m) rb_w32_uchmod((p), (m))
#undef chown
#define chown(p, o, g) rb_w32_uchown(p, o, g)
#define chown(p, o, g) rb_w32_uchown((p), (o), (g))
#undef utime
#define utime(p, t) rb_w32_uutime(p, t)
#define utime(p, t) rb_w32_uutime((p), (t))
#undef link
#define link(f, t) rb_w32_ulink(f, t)
#define link(f, t) rb_w32_ulink((f), (t))
#undef unlink
#define unlink(p) rb_w32_uunlink(p)
#undef rename
#define rename(f, t) rb_w32_urename(f, t)
#define rename(f, t) rb_w32_urename((f), (t))
#else
#define STAT(p, s) stat(p, s)
#define STAT(p, s) stat((p), (s))
#endif
#if defined(__BEOS__) || defined(__HAIKU__) /* should not change ID if -1 */
@ -124,7 +124,7 @@ VALUE rb_cFile;
VALUE rb_mFileTest;
VALUE rb_cStat;
#define insecure_obj_p(obj, level) (level >= 4 || (level > 0 && OBJ_TAINTED(obj)))
#define insecure_obj_p(obj, level) ((level) >= 4 || ((level) > 0 && OBJ_TAINTED(obj)))
static VALUE
file_path_convert(VALUE name)
@ -1099,7 +1099,7 @@ VALUE
rb_file_directory_p(VALUE obj, VALUE fname)
{
#ifndef S_ISDIR
# define S_ISDIR(m) ((m & S_IFMT) == S_IFDIR)
# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
#endif
struct stat st;
@ -1121,7 +1121,7 @@ rb_file_pipe_p(VALUE obj, VALUE fname)
{
#ifdef S_IFIFO
# ifndef S_ISFIFO
# define S_ISFIFO(m) ((m & S_IFMT) == S_IFIFO)
# define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
# endif
struct stat st;
@ -1148,10 +1148,10 @@ rb_file_symlink_p(VALUE obj, VALUE fname)
# define S_ISLNK(m) _S_ISLNK(m)
# else
# ifdef _S_IFLNK
# define S_ISLNK(m) ((m & S_IFMT) == _S_IFLNK)
# define S_ISLNK(m) (((m) & S_IFMT) == _S_IFLNK)
# else
# ifdef S_IFLNK
# define S_ISLNK(m) ((m & S_IFMT) == S_IFLNK)
# define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
# endif
# endif
# endif
@ -1185,10 +1185,10 @@ rb_file_socket_p(VALUE obj, VALUE fname)
# 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
@ -1216,7 +1216,7 @@ rb_file_blockdev_p(VALUE obj, VALUE fname)
{
#ifndef S_ISBLK
# ifdef S_IFBLK
# define S_ISBLK(m) ((m & S_IFMT) == S_IFBLK)
# define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
# else
# define S_ISBLK(m) (0) /* anytime false */
# endif
@ -1242,7 +1242,7 @@ static VALUE
rb_file_chardev_p(VALUE obj, VALUE fname)
{
#ifndef S_ISCHR
# define S_ISCHR(m) ((m & S_IFMT) == S_IFCHR)
# define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
#endif
struct stat st;
@ -1443,7 +1443,7 @@ rb_file_executable_real_p(VALUE obj, VALUE fname)
}
#ifndef S_ISREG
# define S_ISREG(m) ((m & S_IFMT) == S_IFREG)
# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
#endif
/*
@ -3171,8 +3171,8 @@ file_expand_path(VALUE fname, VALUE dname, int abs_mode, VALUE result)
#define EXPAND_PATH_BUFFER() rb_usascii_str_new(0, MAXPATHLEN + 2)
#define check_expand_path_args(fname, dname) \
((fname = rb_get_path(fname)), \
(void)(NIL_P(dname) ? dname : (dname = rb_get_path(dname))))
(((fname) = rb_get_path(fname)), \
(void)(NIL_P(dname) ? (dname) : ((dname) = rb_get_path(dname))))
static VALUE
file_expand_path_1(VALUE fname)
@ -5011,7 +5011,7 @@ path_check_0(VALUE path, int execpath)
#endif
#if ENABLE_PATH_CHECK
#define fpath_check(path) path_check_0(path, FALSE)
#define fpath_check(path) path_check_0((path), FALSE)
#else
#define fpath_check(path) 1
#endif