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
2cb6c277
Commit
2cb6c277
authored
Sep 22, 2015
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
String#index should no longer take integer argument
parent
e47f0fc0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1 addition
and
12 deletions
+1
-12
mrblib/string.rb
mrblib/string.rb
+1
-1
src/string.c
src/string.c
+0
-11
No files found.
mrblib/string.rb
View file @
2cb6c277
...
@@ -12,7 +12,7 @@ class String
...
@@ -12,7 +12,7 @@ class String
def
each_line
(
&
block
)
def
each_line
(
&
block
)
# expect that str.index accepts an Integer for 1st argument as a byte data
# expect that str.index accepts an Integer for 1st argument as a byte data
offset
=
0
offset
=
0
while
pos
=
self
.
index
(
0x0a
,
offset
)
while
pos
=
self
.
index
(
"
\n
"
,
offset
)
block
.
call
(
self
[
offset
,
pos
+
1
-
offset
])
block
.
call
(
self
[
offset
,
pos
+
1
-
offset
])
offset
=
pos
+
1
offset
=
pos
+
1
end
end
...
...
src/string.c
View file @
2cb6c277
...
@@ -1389,17 +1389,6 @@ mrb_str_index_m(mrb_state *mrb, mrb_value str)
...
@@ -1389,17 +1389,6 @@ mrb_str_index_m(mrb_state *mrb, mrb_value str)
}
}
switch
(
mrb_type
(
sub
))
{
switch
(
mrb_type
(
sub
))
{
case
MRB_TT_FIXNUM
:
{
mrb_int
c
=
mrb_fixnum
(
sub
);
mrb_int
len
=
RSTRING_LEN
(
str
);
unsigned
char
*
p
=
(
unsigned
char
*
)
RSTRING_PTR
(
str
);
for
(;
pos
<
len
;
pos
++
)
{
if
(
p
[
pos
]
==
c
)
return
mrb_fixnum_value
(
pos
);
}
return
mrb_nil_value
();
}
default:
{
default:
{
mrb_value
tmp
;
mrb_value
tmp
;
...
...
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