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
e5dde46c
Commit
e5dde46c
authored
Aug 18, 2012
by
Yukihiro Matsumoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reduce mrb_funcall invocations
parent
fd086a7d
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
7 additions
and
7 deletions
+7
-7
src/array.c
src/array.c
+4
-1
src/error.c
src/error.c
+1
-1
src/re.c
src/re.c
+1
-3
src/string.c
src/string.c
+0
-1
src/variable.c
src/variable.c
+1
-1
No files found.
src/array.c
View file @
e5dde46c
...
...
@@ -290,12 +290,15 @@ mrb_ary_cmp(mrb_state *mrb, mrb_value ary1)
a1
=
RARRAY
(
ary1
);
a2
=
RARRAY
(
ary2
);
if
(
a1
->
len
==
a2
->
len
&&
a1
->
ptr
==
a2
->
ptr
)
return
mrb_fixnum_value
(
0
);
else
{
mrb_sym
cmp
=
mrb_intern
(
mrb
,
"<=>"
);
len
=
RARRAY_LEN
(
ary1
);
if
(
len
>
RARRAY_LEN
(
ary2
))
{
len
=
RARRAY_LEN
(
ary2
);
}
for
(
i
=
0
;
i
<
len
;
i
++
)
{
r
=
mrb_funcall
(
mrb
,
ary_elt
(
ary1
,
i
),
"<=>"
,
1
,
ary_elt
(
ary2
,
i
));
mrb_value
v
=
ary_elt
(
ary2
,
i
);
r
=
mrb_funcall_argv
(
mrb
,
ary_elt
(
ary1
,
i
),
cmp
,
1
,
&
v
);
if
(
mrb_type
(
r
)
!=
MRB_TT_FIXNUM
||
mrb_fixnum
(
r
)
!=
0
)
return
r
;
}
}
...
...
src/error.c
View file @
e5dde46c
...
...
@@ -277,7 +277,7 @@ sysexit_status(mrb_state *mrb, mrb_value err)
static
void
set_backtrace
(
mrb_state
*
mrb
,
mrb_value
info
,
mrb_value
bt
)
{
mrb_funcall
(
mrb
,
info
,
"set_backtrace"
,
1
,
bt
);
mrb_funcall
(
mrb
,
info
,
"set_backtrace"
,
1
,
bt
);
}
mrb_value
...
...
src/re.c
View file @
e5dde46c
...
...
@@ -65,8 +65,6 @@ static char * option_to_str(char str[4], int options);
mrb_value
mrb_reg_s_new_instance
(
mrb_state
*
mrb
,
/*int argc, mrb_value *argv, */
mrb_value
self
)
{
//obj = mrb_obj_alloc(klass);
//mrb_obj_call_init(obj, argc, argv);...mrb_funcall2(obj, idInitialize, argc, argv);
mrb_value
argv
[
16
];
int
argc
;
struct
RRegexp
*
re
;
...
...
@@ -76,7 +74,7 @@ mrb_reg_s_new_instance(mrb_state *mrb, /*int argc, mrb_value *argv, */mrb_value
re
->
ptr
=
0
;
re
->
src
=
0
;
re
->
usecnt
=
0
;
return
mrb_funcall_argv
(
mrb
,
mrb_obj_value
(
re
),
mrb
_intern
(
mrb
,
"initialize"
)
,
argc
,
argv
);
return
mrb_funcall_argv
(
mrb
,
mrb_obj_value
(
re
),
mrb
->
init_sym
,
argc
,
argv
);
}
mrb_value
...
...
src/string.c
View file @
e5dde46c
...
...
@@ -1721,7 +1721,6 @@ mrb_str_match_m(mrb_state *mrb, mrb_value self)
mrb_raise
(
mrb
,
E_ARGUMENT_ERROR
,
"wrong number of arguments (%d for 1..2)"
,
argc
);
re
=
argv
[
0
];
argv
[
0
]
=
self
;
// result = mrb_funcall2(get_pat(re, 0), mrb_intern("match"), argc, argv);
result
=
mrb_funcall
(
mrb
,
get_pat
(
mrb
,
re
,
0
),
"match"
,
1
,
self
);
if
(
!
mrb_nil_p
(
result
)
&&
mrb_block_given_p
())
{
return
mrb_yield
(
mrb
,
b
,
result
);
...
...
src/variable.c
View file @
e5dde46c
...
...
@@ -708,7 +708,7 @@ const_get(mrb_state *mrb, struct RClass *base, mrb_sym sym)
while
(
c
)
{
if
(
mrb_respond_to
(
mrb
,
mrb_obj_value
(
c
),
cm
))
{
mrb_value
name
=
mrb_symbol_value
(
sym
);
return
mrb_funcall
(
mrb
,
mrb_obj_value
(
c
),
"const_missing"
,
1
,
name
);
return
mrb_funcall
_argv
(
mrb
,
mrb_obj_value
(
c
),
cm
,
1
,
&
name
);
}
c
=
c
->
super
;
}
...
...
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