aboutsummaryrefslogtreecommitdiffstats
path: root/eval_error.c
diff options
context:
space:
mode:
Diffstat (limited to 'eval_error.c')
-rw-r--r--eval_error.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/eval_error.c b/eval_error.c
index 86e9464f3c..2ce661204c 100644
--- a/eval_error.c
+++ b/eval_error.c
@@ -6,17 +6,18 @@
static void
warn_printf(const char *fmt, ...)
{
- char buf[BUFSIZ];
+ VALUE str;
va_list args;
va_init_list(args, fmt);
- vsnprintf(buf, BUFSIZ, fmt, args);
+ str = rb_vsprintf(fmt, args);
va_end(args);
- rb_write_error(buf);
+ rb_write_error_str(str);
}
#define warn_print(x) rb_write_error(x)
#define warn_print2(x,l) rb_write_error2((x),(l))
+#define warn_print_str(x) rb_write_error_str(x)
static void
error_pos(void)
@@ -122,7 +123,7 @@ error_print(void)
if (NIL_P(mesg))
error_pos();
else {
- warn_print2(RSTRING_PTR(mesg), RSTRING_LEN(mesg));
+ warn_print_str(mesg);
}
}
@@ -147,7 +148,7 @@ error_print(void)
epath = rb_class_name(eclass);
if (elen == 0) {
warn_print(": ");
- warn_print2(RSTRING_PTR(epath), RSTRING_LEN(epath));
+ warn_print_str(epath);
warn_print("\n");
}
else {
@@ -164,7 +165,7 @@ error_print(void)
warn_print2(einfo, len);
if (epath) {
warn_print(" (");
- warn_print2(RSTRING_PTR(epath), RSTRING_LEN(epath));
+ warn_print_str(epath);
warn_print(")\n");
}
if (tail) {
@@ -186,7 +187,7 @@ error_print(void)
for (i = 1; i < len; i++) {
VALUE line = RARRAY_AREF(errat, i);
if (RB_TYPE_P(line, T_STRING)) {
- warn_printf("\tfrom %s\n", RSTRING_PTR(line));
+ warn_printf("\tfrom %"PRIsVALUE"\n", line);
}
if (skip && i == TRACE_HEAD && len > TRACE_MAX) {
warn_printf("\t ... %ld levels...\n",