summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/error.c14
-rw-r--r--src/parse.y2
2 files changed, 9 insertions, 7 deletions
diff --git a/src/error.c b/src/error.c
index 37914666f..1ac42455c 100644
--- a/src/error.c
+++ b/src/error.c
@@ -327,15 +327,17 @@ mrb_warn(mrb_state *mrb, const char *fmt, ...)
}
void
-mrb_bug(const char *fmt, ...)
+mrb_bug(mrb_state *mrb, const char *fmt, ...)
{
#ifdef ENABLE_STDIO
- va_list args;
+ va_list ap;
+ mrb_value str;
- va_start(args, fmt);
- printf("bug: ");
- vprintf(fmt, args);
- va_end(args);
+ va_start(ap, fmt);
+ str = mrb_vformat(mrb, fmt, ap);
+ fputs("bug: ", stderr);
+ fwrite(RSTRING_PTR(str), RSTRING_LEN(str), 1, stderr);
+ va_end(ap);
#endif
exit(EXIT_FAILURE);
}
diff --git a/src/parse.y b/src/parse.y
index 5eaa61b2a..fc2d09f23 100644
--- a/src/parse.y
+++ b/src/parse.y
@@ -3209,7 +3209,7 @@ backref_error(parser_state *p, node *n)
} else if (c == NODE_BACK_REF) {
yyerror_i(p, "can't set variable $%c", (int)(intptr_t)n->cdr);
} else {
- mrb_bug("Internal error in backref_error() : n=>car == %d", c);
+ mrb_bug(p->mrb, "Internal error in backref_error() : n=>car == %d", c);
}
}