should increment p on every iteration; close #254

This commit is contained in:
Yukihiro Matsumoto
2012-06-11 14:33:01 +09:00
parent 9067cf6a75
commit dd550ca0d4
+2 -5
View File
@@ -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;