ruby-changes:18122
From: akr <ko1@a...>
Date: Wed, 8 Dec 2010 20:57:54 +0900 (JST)
Subject: [ruby-changes:18122] Ruby:r30143 (trunk): * dir.c: parenthesize macro arguments.
akr 2010-12-08 20:38:29 +0900 (Wed, 08 Dec 2010) New Revision: 30143 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=30143 Log: * dir.c: parenthesize macro arguments. Modified files: trunk/ChangeLog trunk/dir.c Index: ChangeLog =================================================================== --- ChangeLog (revision 30142) +++ ChangeLog (revision 30143) @@ -1,3 +1,7 @@ +Wed Dec 8 20:37:11 2010 Tanaka Akira <akr@f...> + + * dir.c: parenthesize macro arguments. + Tue Dec 7 22:37:15 2010 Masaya Tarui <tarui@r...> * io.c (io_read): duplicate string if shared. [ruby-dev:42719] @@ -80,7 +84,7 @@ * win32/Makefile.sub (WARNFLAGS): make declaration conflict warnings errors if possible. -Sun Dec 5 10:32:11 2010 Tanaka Akira <akr@f...> +Sun Dec 7 21:16:10 2010 Tanaka Akira <akr@f...> * cont.c: parenthesize macro arguments. Index: dir.c =================================================================== --- dir.c (revision 30142) +++ dir.c (revision 30143) @@ -72,7 +72,7 @@ #undef chdir #define chdir(p) rb_w32_uchdir(p) #undef mkdir -#define mkdir(p, m) rb_w32_umkdir(p, m) +#define mkdir(p, m) rb_w32_umkdir((p), (m)) #undef rmdir #define rmdir(p) rb_w32_urmdir(p) #endif @@ -90,8 +90,8 @@ #define FNM_NOMATCH 1 #define FNM_ERROR 2 -# define Next(p, e, enc) (p + rb_enc_mbclen(p, e, enc)) -# define Inc(p, e, enc) ((p) = Next(p, e, enc)) +# define Next(p, e, enc) ((p)+ rb_enc_mbclen((p), (e), (enc))) +# define Inc(p, e, enc) ((p) = Next((p), (e), (enc))) static char * bracket( @@ -353,9 +353,9 @@ #define GlobPathValue(str, safe) \ /* can contain null bytes as separators */ \ - (!RB_TYPE_P(str, T_STRING) ? \ + (!RB_TYPE_P((str), T_STRING) ? \ (void)FilePathValue(str) : \ - (void)(check_safe_glob(str, safe), \ + (void)(check_safe_glob((str), (safe)), \ check_glob_encoding(str), (str))) #define check_safe_glob(str, safe) ((safe) ? rb_check_safe_obj(str) : (void)0) #define check_glob_encoding(str) rb_enc_check((str), rb_enc_from_encoding(rb_usascii_encoding())) @@ -466,7 +466,7 @@ return dirp; } -#define GetDIR(obj, dirp) (dirp = dir_check(obj)) +#define GetDIR(obj, dirp) ((dirp) = dir_check(obj)) /* @@ -508,11 +508,11 @@ } #if defined HAVE_READDIR_R -# define READDIR(dir, enc, entry, dp) (readdir_r(dir, entry, &(dp)) == 0 && dp != 0) +# define READDIR(dir, enc, entry, dp) (readdir_r((dir), (entry), &(dp)) == 0 && (dp) != 0) #elif defined _WIN32 -# define READDIR(dir, enc, entry, dp) ((dp = rb_w32_readdir_with_enc(dir, enc)) != 0) +# define READDIR(dir, enc, entry, dp) (((dp) = rb_w32_readdir_with_enc((dir), (enc))) != 0) #else -# define READDIR(dir, enc, entry, dp) ((dp = readdir(dir)) != 0) +# define READDIR(dir, enc, entry, dp) (((dp) = readdir(dir)) != 0) #endif #if defined HAVE_READDIR_R # define IF_HAVE_READDIR_R(something) something @@ -997,10 +997,10 @@ #define sys_warning(val) \ (void)((flags & GLOB_VERBOSE) && rb_protect(sys_warning_1, (VALUE)(val), 0)) -#define GLOB_ALLOC(type) (type *)malloc(sizeof(type)) -#define GLOB_ALLOC_N(type, n) (type *)malloc(sizeof(type) * (n)) +#define GLOB_ALLOC(type) ((type *)malloc(sizeof(type))) +#define GLOB_ALLOC_N(type, n) ((type *)malloc(sizeof(type) * (n))) #define GLOB_FREE(ptr) free(ptr) -#define GLOB_JUMP_TAG(status) ((status == -1) ? rb_memerror() : rb_jump_tag(status)) +#define GLOB_JUMP_TAG(status) (((status) == -1) ? rb_memerror() : rb_jump_tag(status)) /* * ENOTDIR can be returned by stat(2) if a non-leaf element of the path @@ -1240,14 +1240,14 @@ enum answer { YES, NO, UNKNOWN }; #ifndef S_ISDIR -# define S_ISDIR(m) ((m & S_IFMT) == S_IFDIR) +# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) #endif #ifndef S_ISLNK # ifndef S_IFLNK # define S_ISLNK(m) (0) # else -# define S_ISLNK(m) ((m & S_IFMT) == S_IFLNK) +# define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) # endif #endif @@ -1267,7 +1267,7 @@ return Qnil; } -#define glob_call_func(func, path, arg, enc) (*func)(path, arg, enc) +#define glob_call_func(func, path, arg, enc) (*(func))((path), (arg), (enc)) static int glob_helper( -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/