ruby-changes:42160
From: nobu <ko1@a...>
Date: Wed, 23 Mar 2016 11:45:00 +0900 (JST)
Subject: [ruby-changes:42160] nobu:r54234 (trunk): remove SIGN_EXTEND_CHAR macro
nobu 2016-03-23 11:44:54 +0900 (Wed, 23 Mar 2016) New Revision: 54234 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=54234 Log: remove SIGN_EXTEND_CHAR macro * marshal.c (r_long): cast to `signed char`, which is used already, instead of SIGN_EXTEND_CHAR. * parse.y: SIGN_EXTEND_CHAR is no longer used. [Fix GH-1302] Modified files: trunk/ChangeLog trunk/marshal.c trunk/parse.y Index: parse.y =================================================================== --- parse.y (revision 54233) +++ parse.y (revision 54234) @@ -5327,18 +5327,6 @@ ripper_dispatch_delayed_token(struct par https://github.com/ruby/ruby/blob/trunk/parse.y#L5327 #include "ruby/regex.h" #include "ruby/util.h" -/* We remove any previous definition of `SIGN_EXTEND_CHAR', - since ours (we hope) works properly with all combinations of - machines, compilers, `char' and `unsigned char' argument types. - (Per Bothner suggested the basic approach.) */ -#undef SIGN_EXTEND_CHAR -#if __STDC__ -# define SIGN_EXTEND_CHAR(c) ((signed char)(c)) -#else /* not __STDC__ */ -/* As in Harbison and Steele. */ -# define SIGN_EXTEND_CHAR(c) ((((unsigned char)(c)) ^ 128) - 128) -#endif - #define parser_encoding_name() (current_enc->name) #define parser_mbclen() mbclen((lex_p-1),lex_pend,current_enc) #define parser_precise_mbclen() rb_enc_precise_mbclen((lex_p-1),lex_pend,current_enc) Index: marshal.c =================================================================== --- marshal.c (revision 54233) +++ marshal.c (revision 54234) @@ -1174,19 +1174,11 @@ long_toobig(int size) https://github.com/ruby/ruby/blob/trunk/marshal.c#L1174 STRINGIZE(SIZEOF_LONG)", given %d)", size); } -#undef SIGN_EXTEND_CHAR -#if __STDC__ -# define SIGN_EXTEND_CHAR(c) ((signed char)(c)) -#else /* not __STDC__ */ -/* As in Harbison and Steele. */ -# define SIGN_EXTEND_CHAR(c) ((((unsigned char)(c)) ^ 128) - 128) -#endif - static long r_long(struct load_arg *arg) { register long x; - int c = SIGN_EXTEND_CHAR(r_byte(arg)); + int c = (signed char)r_byte(arg); long i; if (c == 0) return 0; Index: ChangeLog =================================================================== --- ChangeLog (revision 54233) +++ ChangeLog (revision 54234) @@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Wed Mar 23 11:44:53 2016 cremno <cremno@m...> + + * marshal.c (r_long): cast to `signed char`, which is used + already, instead of SIGN_EXTEND_CHAR. + + * parse.y: SIGN_EXTEND_CHAR is no longer used. [Fix GH-1302] + Wed Mar 23 11:38:47 2016 Nobuyoshi Nakada <nobu@r...> * cygwin/GNUmakefile.in (MSYS2_ARG_CONV_EXCL_PARAM): -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/