ruby-changes:28118
From: naruse <ko1@a...>
Date: Sun, 7 Apr 2013 04:27:13 +0900 (JST)
Subject: [ruby-changes:28118] naruse:r40170 (trunk): * addr2line.c: use more generic type:
naruse 2013-04-07 04:27:04 +0900 (Sun, 07 Apr 2013) New Revision: 40170 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=40170 Log: * addr2line.c: use more generic type: * u_char -> unsigned char * u_short -> unsigned short * u_int -> unsigned int * u_long -> unsigned long * quad_t -> int64_t * u_quad_t -> uint64_t * addr2line.c (imax): inline is defined by configure. Modified files: trunk/ChangeLog trunk/addr2line.c Index: ChangeLog =================================================================== --- ChangeLog (revision 40169) +++ ChangeLog (revision 40170) @@ -1,3 +1,15 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Sun Apr 7 03:24:36 2013 NARUSE, Yui <naruse@r...> + + * addr2line.c: use more generic type: + * u_char -> unsigned char + * u_short -> unsigned short + * u_int -> unsigned int + * u_long -> unsigned long + * quad_t -> int64_t + * u_quad_t -> uint64_t + + * addr2line.c (imax): inline is defined by configure. + Sun Apr 7 01:40:39 2013 Akinori MUSHA <knu@i...> * misc/ruby-electric.el (ruby-electric-hash): New electric Index: addr2line.c =================================================================== --- addr2line.c (revision 40169) +++ addr2line.c (revision 40170) @@ -646,19 +646,6 @@ rb_dump_backtrace_with_lines(int num_tra https://github.com/ruby/ruby/blob/trunk/addr2line.c#L646 free(lines); } -#if defined(__sun) -/* Solaris has different quad_t and does not have u_quad_t */ -# include "ruby/defines.h" -# define quad_t LONG_LONG -# define u_quad_t unsigned LONG_LONG -/* __inline can only be used with GCC or Sun Studio 12 Update 1 or later */ -# if defined(__GNUC__) -# elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590) -# else -# define __inline inline -# endif -#endif /* defined(__sun) */ - /* From FreeBSD's lib/libstand/printf.c */ /*- * Copyright (c) 1986, 1988, 1991, 1993 @@ -702,7 +689,7 @@ extern int rb_toupper(int c); https://github.com/ruby/ruby/blob/trunk/addr2line.c#L689 #define toupper(c) rb_toupper(c) #define hex2ascii(hex) (hex2ascii_data[hex]) char const hex2ascii_data[] = "0123456789abcdefghijklmnopqrstuvwxyz"; -static __inline int imax(int a, int b) { return (a > b ? a : b); } +static inline int imax(int a, int b) { return (a > b ? a : b); } static int kvprintf(char const *fmt, void (*func)(int), void *arg, int radix, va_list ap); static void putce(int c) @@ -782,7 +769,7 @@ kvprintf(char const *fmt, void (*func)(i https://github.com/ruby/ruby/blob/trunk/addr2line.c#L769 char nbuf[MAXNBUF]; char *d; const char *p, *percent, *q; - u_char *up; + unsigned char *up; int ch, n; uintmax_t num; int base, lflag, qflag, tmp, width, ladjust, sharpflag, neg, sign, dot; @@ -806,7 +793,7 @@ kvprintf(char const *fmt, void (*func)(i https://github.com/ruby/ruby/blob/trunk/addr2line.c#L793 for (;;) { padc = ' '; width = 0; - while ((ch = (u_char)*fmt++) != '%' || stop) { + while ((ch = (unsigned char)*fmt++) != '%' || stop) { if (ch == '\0') return (retval); PCHAR(ch); @@ -815,7 +802,7 @@ kvprintf(char const *fmt, void (*func)(i https://github.com/ruby/ruby/blob/trunk/addr2line.c#L802 qflag = 0; lflag = 0; ladjust = 0; sharpflag = 0; neg = 0; sign = 0; dot = 0; dwidth = 0; upper = 0; cflag = 0; hflag = 0; jflag = 0; tflag = 0; zflag = 0; -reswitch: switch (ch = (u_char)*fmt++) { +reswitch: switch (ch = (unsigned char)*fmt++) { case '.': dot = 1; goto reswitch; @@ -861,7 +848,7 @@ reswitch: switch (ch = (u_char)*fmt++) { https://github.com/ruby/ruby/blob/trunk/addr2line.c#L848 width = n; goto reswitch; case 'b': - num = (u_int)va_arg(ap, int); + num = (unsigned int)va_arg(ap, int); p = va_arg(ap, char *); for (q = ksprintn(nbuf, num, *p++, NULL, 0); *q;) PCHAR(*q--); @@ -887,7 +874,7 @@ reswitch: switch (ch = (u_char)*fmt++) { https://github.com/ruby/ruby/blob/trunk/addr2line.c#L874 PCHAR(va_arg(ap, int)); break; case 'D': - up = va_arg(ap, u_char *); + up = va_arg(ap, unsigned char *); p = va_arg(ap, char *); if (!width) width = 16; @@ -926,7 +913,7 @@ reswitch: switch (ch = (u_char)*fmt++) { https://github.com/ruby/ruby/blob/trunk/addr2line.c#L913 if (jflag) *(va_arg(ap, intmax_t *)) = retval; else if (qflag) - *(va_arg(ap, quad_t *)) = retval; + *(va_arg(ap, int64_t *)) = retval; else if (lflag) *(va_arg(ap, long *)) = retval; else if (zflag) @@ -999,25 +986,25 @@ handle_nosign: https://github.com/ruby/ruby/blob/trunk/addr2line.c#L986 if (jflag) num = va_arg(ap, uintmax_t); else if (qflag) - num = va_arg(ap, u_quad_t); + num = va_arg(ap, uint64_t); else if (tflag) num = va_arg(ap, ptrdiff_t); else if (lflag) - num = va_arg(ap, u_long); + num = va_arg(ap, unsigned long); else if (zflag) num = va_arg(ap, size_t); else if (hflag) - num = (u_short)va_arg(ap, int); + num = (unsigned short)va_arg(ap, int); else if (cflag) - num = (u_char)va_arg(ap, int); + num = (unsigned char)va_arg(ap, int); else - num = va_arg(ap, u_int); + num = va_arg(ap, unsigned int); goto number; handle_sign: if (jflag) num = va_arg(ap, intmax_t); else if (qflag) - num = va_arg(ap, quad_t); + num = va_arg(ap, int64_t); else if (tflag) num = va_arg(ap, ptrdiff_t); else if (lflag) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/