[前][次][番号順一覧][スレッド一覧]

ruby-changes:18388

From: akr <ko1@a...>
Date: Tue, 28 Dec 2010 07:38:05 +0900 (JST)
Subject: [ruby-changes:18388] Ruby:r30411 (trunk): * ruby.c: parenthesize macro arguments.

akr	2010-12-28 07:37:59 +0900 (Tue, 28 Dec 2010)

  New Revision: 30411

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=30411

  Log:
    * ruby.c: parenthesize macro arguments.

  Modified files:
    trunk/ChangeLog
    trunk/ruby.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 30410)
+++ ChangeLog	(revision 30411)
@@ -1,3 +1,7 @@
+Tue Dec 28 07:37:38 2010  Tanaka Akira  <akr@f...>
+
+	* ruby.c: parenthesize macro arguments.
+
 Tue Dec 28 07:17:11 2010  Kazuhiro NISHIYAMA  <zn@m...>
 
 	* NEWS: add ARGF.write and so on.
Index: ruby.c
===================================================================
--- ruby.c	(revision 30410)
+++ ruby.c	(revision 30411)
@@ -116,7 +116,7 @@
 
 static NODE *load_file(VALUE, const char *, int, struct cmdline_options *);
 static void forbid_setid(const char *, struct cmdline_options *);
-#define forbid_setid(s) forbid_setid(s, opt)
+#define forbid_setid(s) forbid_setid((s), opt)
 
 static struct {
     int argc;
@@ -257,10 +257,10 @@
 	}
 #ifdef HAVE_CYGWIN_CONV_PATH
 #define CONV_TO_POSIX_PATH(p, lib) \
-	cygwin_conv_path(CCP_WIN_A_TO_POSIX|CCP_RELATIVE, p, lib, sizeof(lib))
+	cygwin_conv_path(CCP_WIN_A_TO_POSIX|CCP_RELATIVE, (p), (lib), sizeof(lib))
 #else
 #define CONV_TO_POSIX_PATH(p, lib) \
-	cygwin_conv_to_posix_path(p, lib)
+	cygwin_conv_to_posix_path((p), (lib))
 #endif
 	if (CONV_TO_POSIX_PATH(p, rubylib) == 0)
 	    p = rubylib;
@@ -440,10 +440,10 @@
 
 #define BASEPATH() rb_str_buf_cat(rb_str_buf_new(baselen+len), libpath, baselen)
 
-#define RUBY_RELATIVE(path, len) rb_str_buf_cat(BASEPATH(), path, len)
+#define RUBY_RELATIVE(path, len) rb_str_buf_cat(BASEPATH(), (path), (len))
 #else
     static const char exec_prefix[] = RUBY_EXEC_PREFIX;
-#define RUBY_RELATIVE(path, len) rubylib_mangled_path(path, len)
+#define RUBY_RELATIVE(path, len) rubylib_mangled_path((path), (len))
 #define PREFIX_PATH() RUBY_RELATIVE(exec_prefix, sizeof(exec_prefix)-1)
 #endif
     load_path = GET_VM()->load_path;
@@ -619,16 +619,16 @@
 }
 
 #define NAME_MATCH_P(name, str, len) \
-    ((len) < (int)sizeof(name) && strncmp((str), name, (len)) == 0)
+    ((len) < (int)sizeof(name) && strncmp((str), (name), (len)) == 0)
 
 #define UNSET_WHEN(name, bit, str, len)	\
-    if (NAME_MATCH_P(name, str, len)) { \
+    if (NAME_MATCH_P((name), (str), (len))) { \
 	*(unsigned int *)arg &= ~(bit); \
 	return;				\
     }
 
 #define SET_WHEN(name, bit, str, len)	\
-    if (NAME_MATCH_P(name, str, len)) { \
+    if (NAME_MATCH_P((name), (str), (len))) { \
 	*(unsigned int *)arg |= (bit);	\
 	return;				\
     }
@@ -692,11 +692,11 @@
 }
 
 #define set_internal_encoding_once(opt, e, elen) \
-    set_option_encoding_once("default_internal", &opt->intern.enc.name, e, elen)
+    set_option_encoding_once("default_internal", &(opt)->intern.enc.name, (e), (elen))
 #define set_external_encoding_once(opt, e, elen) \
-    set_option_encoding_once("default_external", &opt->ext.enc.name, e, elen)
+    set_option_encoding_once("default_external", &(opt)->ext.enc.name, (e), (elen))
 #define set_source_encoding_once(opt, e, elen) \
-    set_option_encoding_once("source", &opt->src.enc.name, e, elen)
+    set_option_encoding_once("source", &(opt)->src.enc.name, (e), (elen))
 
 static long
 proc_options(long argc, char **argv, struct cmdline_options *opt, int envopt)
@@ -971,17 +971,17 @@
 	    s++;
 
 #	define is_option_end(c, allow_hyphen) \
-	    (!(c) || (allow_hyphen && (c) == '-') || (c) == '=')
+	    (!(c) || ((allow_hyphen) && (c) == '-') || (c) == '=')
 #	define check_envopt(name, allow_envopt) \
-	    ((allow_envopt || !envopt) ? (void)0 : \
+	    (((allow_envopt) || !envopt) ? (void)0 : \
 	     rb_raise(rb_eRuntimeError, "invalid switch in RUBYOPT: --" name))
 #	define need_argument(name, s) \
-	    ((*s++ ? !*s : (!--argc || !(s = *++argv))) ?		\
+	    ((*(s)++ ? !*(s) : (!--argc || !((s) = *++argv))) ?		\
 	     rb_raise(rb_eRuntimeError, "missing argument for --" name) \
 	     : (void)0)
 #	define is_option_with_arg(name, allow_hyphen, allow_envopt) \
-	    (strncmp(name, s, n = sizeof(name) - 1) == 0 && is_option_end(s[n], allow_hyphen) ? \
-	     (check_envopt(name, allow_envopt), s += n, need_argument(name, s), 1) : 0)
+	    (strncmp((name), s, n = sizeof(name) - 1) == 0 && is_option_end(s[n], (allow_hyphen)) ? \
+	     (check_envopt(name, (allow_envopt)), s += n, need_argument(name, s), 1) : 0)
 
 	    if (strcmp("copyright", s) == 0) {
 		if (envopt) goto noenvopt_long;

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]