ruby-changes:44249
From: nobu <ko1@a...>
Date: Sun, 2 Oct 2016 08:22:37 +0900 (JST)
Subject: [ruby-changes:44249] nobu:r56322 (trunk): ruby.h: add prefix
nobu 2016-10-02 08:22:30 +0900 (Sun, 02 Oct 2016) New Revision: 56322 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=56322 Log: ruby.h: add prefix * include/ruby/ruby.h (RB_INT2FIX, RB_LONG2FIX): prefix RB to global symbols to get rid of name conflicts with other headers. Modified files: trunk/ChangeLog trunk/include/ruby/ruby.h Index: ChangeLog =================================================================== --- ChangeLog (revision 56321) +++ ChangeLog (revision 56322) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Sun Oct 2 08:22:28 2016 Nobuyoshi Nakada <nobu@r...> + + * include/ruby/ruby.h (RB_INT2FIX, RB_LONG2FIX): prefix RB to + global symbols to get rid of name conflicts with other headers. + Sun Oct 2 07:51:20 2016 Nobuyoshi Nakada <nobu@r...> * string.c (rb_str_hash_m): hash values may be negative. Index: include/ruby/ruby.h =================================================================== --- include/ruby/ruby.h (revision 56321) +++ include/ruby/ruby.h (revision 56322) @@ -228,9 +228,11 @@ typedef char ruby_check_sizeof_voidp[SIZ https://github.com/ruby/ruby/blob/trunk/include/ruby/ruby.h#L228 #define FIXNUM_MAX RUBY_FIXNUM_MAX #define FIXNUM_MIN RUBY_FIXNUM_MIN -#define INT2FIX(i) (((VALUE)(i))<<1 | RUBY_FIXNUM_FLAG) -#define LONG2FIX(i) INT2FIX(i) -#define rb_fix_new(v) INT2FIX(v) +#define RB_INT2FIX(i) (((VALUE)(i))<<1 | RUBY_FIXNUM_FLAG) +#define INT2FIX(i) RB_INT2FIX(i) +#define RB_LONG2FIX(i) RB_INT2FIX(i) +#define LONG2FIX(i) RB_INT2FIX(i) +#define rb_fix_new(v) RB_INT2FIX(v) VALUE rb_int2inum(SIGNED_VALUE); #define rb_int_new(v) rb_int2inum(v) @@ -1183,9 +1185,9 @@ void *rb_check_typeddata(VALUE, const rb https://github.com/ruby/ruby/blob/trunk/include/ruby/ruby.h#L1185 #define RSTRUCT_SET(st, idx, v) rb_struct_aset(st, INT2NUM(idx), (v)) #define RSTRUCT_GET(st, idx) rb_struct_aref(st, INT2NUM(idx)) -#define RBIGNUM_SIGN(b) (FIX2LONG(rb_big_cmp((b), INT2FIX(0))) >= 0) -#define RBIGNUM_POSITIVE_P(b) (FIX2LONG(rb_big_cmp((b), INT2FIX(0))) >= 0) -#define RBIGNUM_NEGATIVE_P(b) (FIX2LONG(rb_big_cmp((b), INT2FIX(0))) < 0) +#define RBIGNUM_SIGN(b) (FIX2LONG(rb_big_cmp((b), RB_INT2FIX(0))) >= 0) +#define RBIGNUM_POSITIVE_P(b) (FIX2LONG(rb_big_cmp((b), RB_INT2FIX(0))) >= 0) +#define RBIGNUM_NEGATIVE_P(b) (FIX2LONG(rb_big_cmp((b), RB_INT2FIX(0))) < 0) #define R_CAST(st) (struct st*) #define RBASIC(obj) (R_CAST(RBasic)(obj)) @@ -1487,14 +1489,14 @@ rb_integer_type_p(VALUE obj) https://github.com/ruby/ruby/blob/trunk/include/ruby/ruby.h#L1489 } #if SIZEOF_INT < SIZEOF_LONG -# define RB_INT2NUM(v) INT2FIX((int)(v)) -# define RB_UINT2NUM(v) LONG2FIX((unsigned int)(v)) +# define RB_INT2NUM(v) RB_INT2FIX((int)(v)) +# define RB_UINT2NUM(v) RB_LONG2FIX((unsigned int)(v)) #else static inline VALUE rb_int2num_inline(int v) { if (RB_FIXABLE(v)) - return INT2FIX(v); + return RB_INT2FIX(v); else return rb_int2big(v); } @@ -1504,7 +1506,7 @@ static inline VALUE https://github.com/ruby/ruby/blob/trunk/include/ruby/ruby.h#L1506 rb_uint2num_inline(unsigned int v) { if (RB_POSFIXABLE(v)) - return LONG2FIX(v); + return RB_LONG2FIX(v); else return rb_uint2big(v); } @@ -1517,7 +1519,7 @@ static inline VALUE https://github.com/ruby/ruby/blob/trunk/include/ruby/ruby.h#L1519 rb_long2num_inline(long v) { if (RB_FIXABLE(v)) - return LONG2FIX(v); + return RB_LONG2FIX(v); else return rb_int2big(v); } @@ -1527,7 +1529,7 @@ static inline VALUE https://github.com/ruby/ruby/blob/trunk/include/ruby/ruby.h#L1529 rb_ulong2num_inline(unsigned long v) { if (RB_POSFIXABLE(v)) - return LONG2FIX(v); + return RB_LONG2FIX(v); else return rb_uint2big(v); } @@ -1543,7 +1545,7 @@ rb_num2char_inline(VALUE x) https://github.com/ruby/ruby/blob/trunk/include/ruby/ruby.h#L1545 } #define RB_NUM2CHR(x) rb_num2char_inline(x) -#define RB_CHR2FIX(x) INT2FIX((long)((x)&0xff)) +#define RB_CHR2FIX(x) RB_INT2FIX((long)((x)&0xff)) #define LONG2NUM(x) RB_LONG2NUM(x) #define ULONG2NUM(x) RB_ULONG2NUM(x) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/