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
0c5f26e0
Commit
0c5f26e0
authored
Apr 24, 2019
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unnecessary `mrb_regexp_check()` and related functions.
parent
9ca9af60
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
6 additions
and
57 deletions
+6
-57
include/mruby.h
include/mruby.h
+0
-4
include/mruby/string.h
include/mruby/string.h
+0
-3
include/mruby/value.h
include/mruby/value.h
+0
-1
src/etc.c
src/etc.c
+0
-16
src/string.c
src/string.c
+6
-33
No files found.
include/mruby.h
View file @
0c5f26e0
...
...
@@ -196,13 +196,9 @@ struct mrb_jmpbuf;
typedef
void
(
*
mrb_atexit_func
)(
struct
mrb_state
*
);
#define MRB_STATE_NO_REGEXP 1
#define MRB_STATE_REGEXP 2
typedef
struct
mrb_state
{
struct
mrb_jmpbuf
*
jmp
;
uint32_t
flags
;
mrb_allocf
allocf
;
/* memory allocation function */
void
*
allocf_ud
;
/* auxiliary data of allocf */
...
...
include/mruby/string.h
View file @
0c5f26e0
...
...
@@ -433,9 +433,6 @@ mrb_value mrb_str_dump(mrb_state *mrb, mrb_value str);
*/
mrb_value
mrb_str_inspect
(
mrb_state
*
mrb
,
mrb_value
str
);
void
mrb_noregexp
(
mrb_state
*
mrb
,
mrb_value
self
);
void
mrb_regexp_check
(
mrb_state
*
mrb
,
mrb_value
obj
);
/* For backward compatibility */
#define mrb_str_cat2(mrb, str, ptr) mrb_str_cat_cstr(mrb, str, ptr)
#define mrb_str_buf_cat(mrb, str, ptr, len) mrb_str_cat(mrb, str, ptr, len)
...
...
include/mruby/value.h
View file @
0c5f26e0
...
...
@@ -180,7 +180,6 @@ typedef void mrb_value;
#define mrb_cptr_p(o) (mrb_type(o) == MRB_TT_CPTR)
#define mrb_exception_p(o) (mrb_type(o) == MRB_TT_EXCEPTION)
#define mrb_test(o) mrb_bool(o)
MRB_API
mrb_bool
mrb_regexp_p
(
struct
mrb_state
*
,
mrb_value
);
/*
* Returns a float in Ruby.
...
...
src/etc.c
View file @
0c5f26e0
...
...
@@ -194,22 +194,6 @@ mrb_word_boxing_cptr_value(mrb_state *mrb, void *p)
}
#endif
/* MRB_WORD_BOXING */
MRB_API
mrb_bool
mrb_regexp_p
(
mrb_state
*
mrb
,
mrb_value
v
)
{
if
(
mrb
->
flags
&
MRB_STATE_NO_REGEXP
)
{
return
FALSE
;
}
if
((
mrb
->
flags
&
MRB_STATE_REGEXP
)
||
mrb_class_defined
(
mrb
,
REGEXP_CLASS
))
{
mrb
->
flags
|=
MRB_STATE_REGEXP
;
return
mrb_obj_is_kind_of
(
mrb
,
v
,
mrb_class_get
(
mrb
,
REGEXP_CLASS
));
}
else
{
mrb
->
flags
|=
MRB_STATE_NO_REGEXP
;
}
return
FALSE
;
}
#if defined _MSC_VER && _MSC_VER < 1900
#ifndef va_copy
...
...
src/string.c
View file @
0c5f26e0
...
...
@@ -997,20 +997,6 @@ mrb_string_value_len(mrb_state *mrb, mrb_value ptr)
return
RSTRING_LEN
(
ptr
);
}
void
mrb_noregexp
(
mrb_state
*
mrb
,
mrb_value
self
)
{
mrb_raise
(
mrb
,
E_NOTIMP_ERROR
,
"Regexp class not implemented"
);
}
void
mrb_regexp_check
(
mrb_state
*
mrb
,
mrb_value
obj
)
{
if
(
mrb_regexp_p
(
mrb
,
obj
))
{
mrb_noregexp
(
mrb
,
obj
);
}
}
MRB_API
mrb_value
mrb_str_dup
(
mrb_state
*
mrb
,
mrb_value
str
)
{
...
...
@@ -1026,7 +1012,6 @@ mrb_str_aref(mrb_state *mrb, mrb_value str, mrb_value indx)
{
mrb_int
idx
;
mrb_regexp_check
(
mrb
,
indx
);
switch
(
mrb_type
(
indx
))
{
case
MRB_TT_FIXNUM
:
idx
=
mrb_fixnum
(
indx
);
...
...
@@ -1119,7 +1104,6 @@ mrb_str_aref_m(mrb_state *mrb, mrb_value str)
if
(
argc
==
2
)
{
mrb_int
n1
,
n2
;
mrb_regexp_check
(
mrb
,
a1
);
mrb_get_args
(
mrb
,
"ii"
,
&
n1
,
&
n2
);
return
str_substr
(
mrb
,
str
,
n1
,
n2
);
}
...
...
@@ -1549,7 +1533,6 @@ mrb_str_index_m(mrb_state *mrb, mrb_value str)
else
sub
=
mrb_nil_value
();
}
mrb_regexp_check
(
mrb
,
sub
);
clen
=
RSTRING_CHAR_LEN
(
str
);
if
(
pos
<
0
)
{
pos
+=
clen
;
...
...
@@ -1801,7 +1784,6 @@ mrb_str_rindex(mrb_state *mrb, mrb_value str)
if
(
pos
<
0
)
{
pos
+=
len
;
if
(
pos
<
0
)
{
mrb_regexp_check
(
mrb
,
sub
);
return
mrb_nil_value
();
}
}
...
...
@@ -1815,7 +1797,6 @@ mrb_str_rindex(mrb_state *mrb, mrb_value str)
sub
=
mrb_nil_value
();
}
pos
=
chars2bytes
(
str
,
0
,
pos
);
mrb_regexp_check
(
mrb
,
sub
);
switch
(
mrb_type
(
sub
))
{
default:
{
...
...
@@ -1909,16 +1890,11 @@ mrb_str_split_m(mrb_state *mrb, mrb_value str)
if
(
argc
==
0
||
mrb_nil_p
(
spat
))
{
split_type
=
awk
;
}
else
{
if
(
mrb_string_p
(
spat
))
{
split_type
=
string
;
if
(
RSTRING_LEN
(
spat
)
==
1
&&
RSTRING_PTR
(
spat
)[
0
]
==
' '
)
{
split_type
=
awk
;
}
}
else
{
mrb_noregexp
(
mrb
,
str
);
}
else
if
(
!
mrb_string_p
(
spat
))
{
mrb_raise
(
mrb
,
E_TYPE_ERROR
,
"expected String"
);
}
else
if
(
RSTRING_LEN
(
spat
)
==
1
&&
RSTRING_PTR
(
spat
)[
0
]
==
' '
)
{
split_type
=
awk
;
}
result
=
mrb_ary_new
(
mrb
);
...
...
@@ -1955,7 +1931,7 @@ mrb_str_split_m(mrb_state *mrb, mrb_value str)
}
}
}
else
if
(
split_type
==
string
)
{
else
{
/* split_type == string */
mrb_int
str_len
=
RSTRING_LEN
(
str
);
mrb_int
pat_len
=
RSTRING_LEN
(
spat
);
mrb_int
idx
=
0
;
...
...
@@ -1976,9 +1952,6 @@ mrb_str_split_m(mrb_state *mrb, mrb_value str)
}
beg
=
idx
;
}
else
{
mrb_noregexp
(
mrb
,
str
);
}
if
(
RSTRING_LEN
(
str
)
>
0
&&
(
lim_p
||
RSTRING_LEN
(
str
)
>
beg
||
lim
<
0
))
{
if
(
RSTRING_LEN
(
str
)
==
beg
)
{
tmp
=
mrb_str_new_empty
(
mrb
,
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