summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorYukihiro Matsumoto <[email protected]>2012-06-11 14:33:01 +0900
committerYukihiro Matsumoto <[email protected]>2012-06-11 14:33:01 +0900
commitdd550ca0d494e35efc60142606976a5a41acd5be (patch)
tree8641f86e1f4b44db29b4bac1acb6067a94a278c5
parent9067cf6a75d7180ebba6c3ecf04d96b2f3831bb1 (diff)
downloadmruby-dd550ca0d494e35efc60142606976a5a41acd5be.tar.gz
mruby-dd550ca0d494e35efc60142606976a5a41acd5be.zip
should increment p on every iteration; close #254
-rw-r--r--src/string.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/string.c b/src/string.c
index 67cc32137..1de0d9592 100644
--- a/src/string.c
+++ b/src/string.c
@@ -2945,11 +2945,11 @@ mrb_str_inspect(mrb_state *mrb, mrb_value str)
p = RSTRING_PTR(str); pend = RSTRING_END(str);
prev = p;
- while (p < pend) {
+ for (;p < pend; p++) {
unsigned int c, cc;
int n;
- c = *p++;
+ c = *p;
n = 1;
if (c == '"'|| c == '\\' || (c == '#' && IS_EVSTR(p, pend))) {
buf[0] = '\\'; buf[1] = c;
@@ -2988,9 +2988,6 @@ mrb_str_inspect(mrb_state *mrb, mrb_value str)
continue;
}
}
-#ifdef INCLUDE_ENCODING
- if (p > prev) mrb_str_buf_cat(mrb, result, prev, p - prev);
-#endif
mrb_str_buf_cat(mrb, result, "\"", strlen("\""));
return result;