summaryrefslogtreecommitdiffhomepage
path: root/src/error.c
diff options
context:
space:
mode:
authorMasaki Muranaka <[email protected]>2013-03-28 15:07:34 +0900
committerMasaki Muranaka <[email protected]>2013-03-28 15:07:34 +0900
commit9c831c9a9c69e32d6a75bb47c09a44c6d501a20b (patch)
tree1b8d727aa7932bccb37d35c623209aaf1251a23f /src/error.c
parente265d7c7efe51bc425e39c7fa208a6f421bba199 (diff)
downloadmruby-9c831c9a9c69e32d6a75bb47c09a44c6d501a20b.tar.gz
mruby-9c831c9a9c69e32d6a75bb47c09a44c6d501a20b.zip
Remove the escape backslash from the result string.
Diffstat (limited to 'src/error.c')
-rw-r--r--src/error.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/error.c b/src/error.c
index 52e4958a1..0ad0df5f7 100644
--- a/src/error.c
+++ b/src/error.c
@@ -249,8 +249,15 @@ mrb_vformat(mrb_state *mrb, const char *format, va_list ap)
}
}
else if (c == '\\') {
- if (!*p) break;
- p++;
+ if (*p) {
+ size = p - b - 1;
+ mrb_ary_push(mrb, ary, mrb_str_new(mrb, b, size));
+ mrb_ary_push(mrb, ary, mrb_str_new(mrb, p, 1));
+ b = ++p;
+ }
+ else {
+ break;
+ }
}
p++;
}