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

ruby-changes:44960

From: nobu <ko1@a...>
Date: Fri, 9 Dec 2016 12:25:25 +0900 (JST)
Subject: [ruby-changes:44960] nobu:r57033 (trunk): ruby.h: add prefix

nobu	2016-12-09 12:25:20 +0900 (Fri, 09 Dec 2016)

  New Revision: 57033

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=57033

  Log:
    ruby.h: add prefix
    
    * include/ruby/ruby.h (RB_TEST, RB_NIL_P): prefix RB to get rid of
      name conflicts with other headers.

  Modified files:
    trunk/include/ruby/ruby.h
Index: include/ruby/ruby.h
===================================================================
--- include/ruby/ruby.h	(revision 57032)
+++ include/ruby/ruby.h	(revision 57033)
@@ -441,8 +441,10 @@ enum ruby_special_consts { https://github.com/ruby/ruby/blob/trunk/include/ruby/ruby.h#L441
 #endif
 #define SYMBOL_FLAG RUBY_SYMBOL_FLAG
 
-#define RTEST(v) !(((VALUE)(v) & ~RUBY_Qnil) == 0)
-#define NIL_P(v) !((VALUE)(v) != RUBY_Qnil)
+#define RB_TEST(v) !(((VALUE)(v) & ~RUBY_Qnil) == 0)
+#define RB_NIL_P(v) !((VALUE)(v) != RUBY_Qnil)
+#define RTEST(v) RB_TEST(v)
+#define NIL_P(v) RB_NIL_P(v)
 
 #define CLASS_OF(v) rb_class_of((VALUE)(v))
 
@@ -1235,7 +1237,7 @@ int rb_big_sign(VALUE); https://github.com/ruby/ruby/blob/trunk/include/ruby/ruby.h#L1237
 #define FL_USER18 	RUBY_FL_USER18
 #define FL_USER19 	RUBY_FL_USER19
 
-#define RB_SPECIAL_CONST_P(x) (RB_IMMEDIATE_P(x) || !RTEST(x))
+#define RB_SPECIAL_CONST_P(x) (RB_IMMEDIATE_P(x) || !RB_TEST(x))
 #define SPECIAL_CONST_P(x) RB_SPECIAL_CONST_P(x)
 
 #define RB_FL_ABLE(x) (!RB_SPECIAL_CONST_P(x) && RB_BUILTIN_TYPE(x) != RUBY_T_NODE)
@@ -1474,7 +1476,7 @@ rb_obj_write(VALUE a, VALUE *slot, VALUE https://github.com/ruby/ruby/blob/trunk/include/ruby/ruby.h#L1476
     *slot = b;
 
 #if USE_RGENGC
-    rb_obj_written(a, Qundef /* ignore `oldv' now */, b, filename, line);
+    rb_obj_written(a, RUBY_Qundef /* ignore `oldv' now */, b, filename, line);
 #endif
     return a;
 }
@@ -1945,7 +1947,7 @@ rb_class_of(VALUE obj) https://github.com/ruby/ruby/blob/trunk/include/ruby/ruby.h#L1947
 	if (obj == RUBY_Qtrue)  return rb_cTrueClass;
 	if (RB_STATIC_SYM_P(obj)) return rb_cSymbol;
     }
-    else if (!RTEST(obj)) {
+    else if (!RB_TEST(obj)) {
 	if (obj == RUBY_Qnil)   return rb_cNilClass;
 	if (obj == RUBY_Qfalse) return rb_cFalseClass;
     }
@@ -1962,7 +1964,7 @@ rb_type(VALUE obj) https://github.com/ruby/ruby/blob/trunk/include/ruby/ruby.h#L1964
 	if (RB_STATIC_SYM_P(obj)) return RUBY_T_SYMBOL;
 	if (obj == RUBY_Qundef) return RUBY_T_UNDEF;
     }
-    else if (!RTEST(obj)) {
+    else if (!RB_TEST(obj)) {
 	if (obj == RUBY_Qnil)   return RUBY_T_NIL;
 	if (obj == RUBY_Qfalse) return RUBY_T_FALSE;
     }
@@ -2340,7 +2342,7 @@ rb_scan_args_set(int argc, const VALUE * https://github.com/ruby/ruby/blob/trunk/include/ruby/ruby.h#L2342
     if (f_hash && n_mand < argc) {
 	VALUE last = argv[argc - 1];
 
-	if (NIL_P(last)) {
+	if (RB_NIL_P(last)) {
 	    /* nil is taken as an empty option hash only if it is not
 	       ambiguous; i.e. '*' is not specified and arguments are
 	       given more than sufficient */
@@ -2349,7 +2351,7 @@ rb_scan_args_set(int argc, const VALUE * https://github.com/ruby/ruby/blob/trunk/include/ruby/ruby.h#L2351
 	}
 	else {
 	    hash = rb_check_hash_type(last);
-	    if (!NIL_P(hash)) {
+	    if (!RB_NIL_P(hash)) {
 		VALUE opts = rb_extract_keywords(&hash);
 		if (!hash) argc--;
 		hash = opts ? opts : Qnil;

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

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