mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
resolve conflict in class.c
This commit is contained in:
+2
-2
@@ -1149,11 +1149,11 @@ mrb_mod_to_s(mrb_state *mrb, mrb_value klass)
|
||||
|
||||
switch (mrb_type(klass)) {
|
||||
case MRB_TT_CLASS:
|
||||
n = snprintf(buf, 256, "#<Class:%p>", c);
|
||||
n = snprintf(buf, sizeof(buf), "#<Class:%p>", c);
|
||||
break;
|
||||
|
||||
case MRB_TT_MODULE:
|
||||
n = snprintf(buf, 256, "#<Module:%p>", c);
|
||||
n = snprintf(buf, sizeof(buf), "#<Module:%p>", c);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
+2
-2
@@ -1537,7 +1537,7 @@ codegen(codegen_scope *s, node *tree, int val)
|
||||
int len;
|
||||
int sym;
|
||||
|
||||
len = snprintf(buf, 3, "$%c", (int)(intptr_t)tree);
|
||||
len = snprintf(buf, sizeof(buf), "$%c", (int)(intptr_t)tree);
|
||||
sym = new_sym(s, mrb_intern2(s->mrb, buf, len));
|
||||
genop(s, MKOP_ABx(OP_GETGLOBAL, cursp(), sym));
|
||||
push();
|
||||
@@ -1550,7 +1550,7 @@ codegen(codegen_scope *s, node *tree, int val)
|
||||
int len;
|
||||
int sym;
|
||||
|
||||
len = snprintf(buf, 3, "$%d", (int)(intptr_t)tree);
|
||||
len = snprintf(buf, sizeof(buf), "$%d", (int)(intptr_t)tree);
|
||||
sym = new_sym(s, mrb_intern2(s->mrb, buf, len));
|
||||
genop(s, MKOP_ABx(OP_GETGLOBAL, cursp(), sym));
|
||||
push();
|
||||
|
||||
+3
-3
@@ -180,7 +180,7 @@ mrb_raise(mrb_state *mrb, struct RClass *c, const char *fmt, ...)
|
||||
int n;
|
||||
|
||||
va_start(args, fmt);
|
||||
n = vsnprintf(buf, 256, fmt, args);
|
||||
n = vsnprintf(buf, sizeof(buf), fmt, args);
|
||||
va_end(args);
|
||||
if (n < 0) {
|
||||
n = 0;
|
||||
@@ -197,7 +197,7 @@ mrb_name_error(mrb_state *mrb, mrb_sym id, const char *fmt, ...)
|
||||
int n;
|
||||
|
||||
va_start(args, fmt);
|
||||
n = vsnprintf(buf, 256, fmt, args);
|
||||
n = vsnprintf(buf, sizeof(buf), fmt, args);
|
||||
va_end(args);
|
||||
if (n < 0) {
|
||||
n = 0;
|
||||
@@ -216,7 +216,7 @@ mrb_sprintf(mrb_state *mrb, const char *fmt, ...)
|
||||
int n;
|
||||
|
||||
va_start(args, fmt);
|
||||
n = vsnprintf(buf, 256, fmt, args);
|
||||
n = vsnprintf(buf, sizeof(buf), fmt, args);
|
||||
va_end(args);
|
||||
if (n < 0) {
|
||||
n = 0;
|
||||
|
||||
+11
-11
@@ -2587,7 +2587,7 @@ var_ref : variable
|
||||
{
|
||||
char buf[16];
|
||||
|
||||
snprintf(buf, 16, "%d", p->lineno);
|
||||
snprintf(buf, sizeof(buf), "%d", p->lineno);
|
||||
$$ = new_int(p, buf, 10);
|
||||
}
|
||||
;
|
||||
@@ -2955,7 +2955,7 @@ yyerror_i(parser_state *p, const char *fmt, int i)
|
||||
{
|
||||
char buf[256];
|
||||
|
||||
snprintf(buf, 256, fmt, i);
|
||||
snprintf(buf, sizeof(buf), fmt, i);
|
||||
yyerror(p, buf);
|
||||
}
|
||||
|
||||
@@ -2995,7 +2995,7 @@ yywarning_s(parser_state *p, const char *fmt, const char *s)
|
||||
{
|
||||
char buf[256];
|
||||
|
||||
snprintf(buf, 256, fmt, s);
|
||||
snprintf(buf, sizeof(buf), fmt, s);
|
||||
yywarning(p, buf);
|
||||
}
|
||||
|
||||
@@ -3201,9 +3201,9 @@ toklen(parser_state *p)
|
||||
#define IS_LABEL_SUFFIX(n) (peek_n(p, ':',(n)) && !peek_n(p, ':', (n)+1))
|
||||
|
||||
static unsigned long
|
||||
scan_oct(const char *start, int len, int *retlen)
|
||||
scan_oct(const int *start, int len, int *retlen)
|
||||
{
|
||||
const char *s = start;
|
||||
const int *s = start;
|
||||
unsigned long retval = 0;
|
||||
|
||||
while (len-- && *s >= '0' && *s <= '7') {
|
||||
@@ -3215,10 +3215,10 @@ scan_oct(const char *start, int len, int *retlen)
|
||||
}
|
||||
|
||||
static unsigned long
|
||||
scan_hex(const char *start, int len, int *retlen)
|
||||
scan_hex(const int *start, int len, int *retlen)
|
||||
{
|
||||
static const char hexdigit[] = "0123456789abcdef0123456789ABCDEF";
|
||||
register const char *s = start;
|
||||
register const int *s = start;
|
||||
register unsigned long retval = 0;
|
||||
char *tmp;
|
||||
|
||||
@@ -3264,7 +3264,7 @@ read_escape(parser_state *p)
|
||||
case '0': case '1': case '2': case '3': /* octal constant */
|
||||
case '4': case '5': case '6': case '7':
|
||||
{
|
||||
char buf[3];
|
||||
int buf[3];
|
||||
int i;
|
||||
|
||||
for (i=0; i<3; i++) {
|
||||
@@ -3281,7 +3281,7 @@ read_escape(parser_state *p)
|
||||
|
||||
case 'x': /* hex constant */
|
||||
{
|
||||
char buf[2];
|
||||
int buf[2];
|
||||
int i;
|
||||
|
||||
for (i=0; i<2; i++) {
|
||||
@@ -3702,7 +3702,7 @@ parser_yylex(parser_state *p)
|
||||
}
|
||||
if (c2) {
|
||||
char buf[256];
|
||||
snprintf(buf, 256, "invalid character syntax; use ?\\%c", c2);
|
||||
snprintf(buf, sizeof(buf), "invalid character syntax; use ?\\%c", c2);
|
||||
yyerror(p, buf);
|
||||
}
|
||||
}
|
||||
@@ -4542,7 +4542,7 @@ parser_yylex(parser_state *p)
|
||||
pushback(p, c);
|
||||
}
|
||||
}
|
||||
if (result == 0 && isupper(tok(p)[0])) {
|
||||
if (result == 0 && isupper((int)tok(p)[0])) {
|
||||
result = tCONSTANT;
|
||||
}
|
||||
else {
|
||||
|
||||
+1
-1
@@ -435,7 +435,7 @@ mrb_time_asctime(mrb_state *mrb, mrb_value self)
|
||||
tm = mrb_get_datatype(mrb, self, &mrb_time_type);
|
||||
if (!tm) return mrb_nil_value();
|
||||
d = &tm->datetime;
|
||||
len = snprintf(buf, 256, "%s %s %02d %02d:%02d:%02d %s%d",
|
||||
len = snprintf(buf, sizeof(buf), "%s %s %02d %02d:%02d:%02d %s%d",
|
||||
wday_names[d->tm_wday], mon_names[d->tm_mon], d->tm_mday,
|
||||
d->tm_hour, d->tm_min, d->tm_sec,
|
||||
tm->timezone == MRB_TIMEZONE_UTC ? "UTC " : "",
|
||||
|
||||
@@ -295,7 +295,7 @@ localjump_error(mrb_state *mrb, const char *kind)
|
||||
int len;
|
||||
mrb_value exc;
|
||||
|
||||
len = snprintf(buf, 256, "unexpected %s", kind);
|
||||
len = snprintf(buf, sizeof(buf), "unexpected %s", kind);
|
||||
exc = mrb_exc_new(mrb, E_LOCALJUMP_ERROR, buf, len);
|
||||
mrb->exc = (struct RObject*)mrb_object(exc);
|
||||
}
|
||||
@@ -308,12 +308,12 @@ argnum_error(mrb_state *mrb, int num)
|
||||
mrb_value exc;
|
||||
|
||||
if (mrb->ci->mid) {
|
||||
len = snprintf(buf, 256, "'%s': wrong number of arguments (%d for %d)",
|
||||
len = snprintf(buf, sizeof(buf), "'%s': wrong number of arguments (%d for %d)",
|
||||
mrb_sym2name(mrb, mrb->ci->mid),
|
||||
mrb->ci->argc, num);
|
||||
}
|
||||
else {
|
||||
len = snprintf(buf, 256, "wrong number of arguments (%d for %d)",
|
||||
len = snprintf(buf, sizeof(buf), "wrong number of arguments (%d for %d)",
|
||||
mrb->ci->argc, num);
|
||||
}
|
||||
exc = mrb_exc_new(mrb, E_ARGUMENT_ERROR, buf, len);
|
||||
|
||||
Reference in New Issue
Block a user