Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mruby
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
mruby
Commits
477be452
Unverified
Commit
477be452
authored
Jul 22, 2019
by
Yukihiro "Matz" Matsumoto
Committed by
GitHub
Jul 22, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4592 from shuujii/set-MRB_STR_ASCII-flag-in-String-inspect
Set `MRB_STR_ASCII` flag in `String#inspect`
parents
d7435506
fe8b463c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
1 deletion
+8
-1
src/string.c
src/string.c
+8
-1
No files found.
src/string.c
View file @
477be452
...
...
@@ -2789,6 +2789,9 @@ mrb_str_inspect(mrb_state *mrb, mrb_value str)
const
char
*
p
,
*
pend
;
char
buf
[
CHAR_ESC_LEN
+
1
];
mrb_value
result
=
mrb_str_new_lit
(
mrb
,
"
\"
"
);
#ifdef MRB_UTF8_STRING
uint32_t
ascii_flag
=
MRB_STR_ASCII
;
#endif
p
=
RSTRING_PTR
(
str
);
pend
=
RSTRING_END
(
str
);
for
(;
p
<
pend
;
p
++
)
{
...
...
@@ -2805,6 +2808,7 @@ mrb_str_inspect(mrb_state *mrb, mrb_value str)
}
mrb_str_cat
(
mrb
,
result
,
buf
,
clen
);
p
+=
clen
-
1
;
ascii_flag
=
0
;
continue
;
}
#endif
...
...
@@ -2846,7 +2850,10 @@ mrb_str_inspect(mrb_state *mrb, mrb_value str)
}
}
mrb_str_cat_lit
(
mrb
,
result
,
"
\"
"
);
RSTR_COPY_ASCII_FLAG
(
mrb_str_ptr
(
result
),
mrb_str_ptr
(
str
));
#ifdef MRB_UTF8_STRING
mrb_str_ptr
(
str
)
->
flags
|=
ascii_flag
;
mrb_str_ptr
(
result
)
->
flags
|=
ascii_flag
;
#endif
return
result
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment