Skip to content

Commit

Permalink
remove SIGN_EXTEND_CHAR macro
Browse files Browse the repository at this point in the history
* 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]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54234 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
nobu committed Mar 23, 2016
1 parent 6c8efc0 commit 7bfeb1c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 21 deletions.
7 changes: 7 additions & 0 deletions ChangeLog
@@ -1,3 +1,10 @@
Wed Mar 23 11:44:53 2016 cremno <cremno@mail.ru>

* 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@ruby-lang.org>

* cygwin/GNUmakefile.in (MSYS2_ARG_CONV_EXCL_PARAM):
Expand Down
10 changes: 1 addition & 9 deletions marshal.c
Expand Up @@ -1174,19 +1174,11 @@ long_toobig(int size)
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;
Expand Down
12 changes: 0 additions & 12 deletions parse.y
Expand Up @@ -5327,18 +5327,6 @@ ripper_dispatch_delayed_token(struct parser_params *parser, int t)
#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)
Expand Down

0 comments on commit 7bfeb1c

Please sign in to comment.