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
c6551e03
Commit
c6551e03
authored
May 05, 2014
by
Jun Hiroe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor mrb_str_capitalize_bang()
parent
5921dd19
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
src/string.c
src/string.c
+3
-3
No files found.
src/string.c
View file @
c6551e03
...
@@ -914,7 +914,7 @@ static mrb_value
...
@@ -914,7 +914,7 @@ static mrb_value
mrb_str_capitalize_bang
(
mrb_state
*
mrb
,
mrb_value
str
)
mrb_str_capitalize_bang
(
mrb_state
*
mrb
,
mrb_value
str
)
{
{
char
*
p
,
*
pend
;
char
*
p
,
*
pend
;
int
modify
=
0
;
mrb_bool
modify
=
FALSE
;
struct
RString
*
s
=
mrb_str_ptr
(
str
);
struct
RString
*
s
=
mrb_str_ptr
(
str
);
mrb_str_modify
(
mrb
,
s
);
mrb_str_modify
(
mrb
,
s
);
...
@@ -922,12 +922,12 @@ mrb_str_capitalize_bang(mrb_state *mrb, mrb_value str)
...
@@ -922,12 +922,12 @@ mrb_str_capitalize_bang(mrb_state *mrb, mrb_value str)
p
=
STR_PTR
(
s
);
pend
=
STR_PTR
(
s
)
+
STR_LEN
(
s
);
p
=
STR_PTR
(
s
);
pend
=
STR_PTR
(
s
)
+
STR_LEN
(
s
);
if
(
ISLOWER
(
*
p
))
{
if
(
ISLOWER
(
*
p
))
{
*
p
=
TOUPPER
(
*
p
);
*
p
=
TOUPPER
(
*
p
);
modify
=
1
;
modify
=
TRUE
;
}
}
while
(
++
p
<
pend
)
{
while
(
++
p
<
pend
)
{
if
(
ISUPPER
(
*
p
))
{
if
(
ISUPPER
(
*
p
))
{
*
p
=
TOLOWER
(
*
p
);
*
p
=
TOLOWER
(
*
p
);
modify
=
1
;
modify
=
TRUE
;
}
}
}
}
if
(
modify
)
return
str
;
if
(
modify
)
return
str
;
...
...
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