1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40170 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2013-04-06 19:27:04 +00:00
parent 59eacb45e5
commit c73c876d54
2 changed files with 25 additions and 26 deletions

View file

@ -1,3 +1,15 @@
Sun Apr 7 03:24:36 2013 NARUSE, Yui <naruse@ruby-lang.org>
* 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@iDaemons.org>
* misc/ruby-electric.el (ruby-electric-hash): New electric

View file

@ -646,19 +646,6 @@ rb_dump_backtrace_with_lines(int num_traces, void **trace, char **syms)
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);
#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)(int), void *arg, int radix, va_list ap)
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)(int), void *arg, int radix, va_list ap)
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)(int), void *arg, int radix, va_list ap)
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++) {
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++) {
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++) {
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:
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)