Commit 41c43234 authored by KOBAYASHI Shuji's avatar KOBAYASHI Shuji

Fix incorrect `MRB_STR_ASCII` flag update in `mrb_str_dump`

### Example (with `MRB_UTF8_STRING`)

  ```ruby
  s = "\u3042"
  p s.size
  s.dump
  p s.size
  ```

#### Before this patch:

  ```
  1
  3
  ```

#### After this patch:

  ```
  1
  1
  ```
parent 1aacde20
......@@ -1388,8 +1388,13 @@ str_escape(mrb_state *mrb, mrb_value str, mrb_bool inspect)
}
mrb_str_cat_lit(mrb, result, "\"");
#ifdef MRB_UTF8_STRING
mrb_str_ptr(str)->flags |= ascii_flag;
mrb_str_ptr(result)->flags |= ascii_flag;
if (inspect) {
mrb_str_ptr(str)->flags |= ascii_flag;
mrb_str_ptr(result)->flags |= ascii_flag;
}
else {
RSTR_SET_ASCII_FLAG(mrb_str_ptr(result));
}
#endif
return result;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment