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
40f57f7b
Commit
40f57f7b
authored
Mar 09, 2014
by
Masaki Muranaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use mrb_str_new_cstr() instead of mrb_str_new() with strlen().
parent
4f27089b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 deletions
+5
-5
mrbgems/mruby-bin-mruby/tools/mruby/mruby.c
mrbgems/mruby-bin-mruby/tools/mruby/mruby.c
+1
-1
src/codegen.c
src/codegen.c
+4
-4
No files found.
mrbgems/mruby-bin-mruby/tools/mruby/mruby.c
View file @
40f57f7b
...
...
@@ -193,7 +193,7 @@ main(int argc, char **argv)
ARGV
=
mrb_ary_new_capa
(
mrb
,
args
.
argc
);
for
(
i
=
0
;
i
<
args
.
argc
;
i
++
)
{
mrb_ary_push
(
mrb
,
ARGV
,
mrb_str_new
(
mrb
,
args
.
argv
[
i
],
strlen
(
args
.
argv
[
i
])
));
mrb_ary_push
(
mrb
,
ARGV
,
mrb_str_new
_cstr
(
mrb
,
args
.
argv
[
i
]
));
}
mrb_define_global_const
(
mrb
,
"ARGV"
,
ARGV
);
...
...
src/codegen.c
View file @
40f57f7b
...
...
@@ -2107,7 +2107,7 @@ codegen(codegen_scope *s, node *tree, int val)
char
*
p2
=
(
char
*
)
tree
->
cdr
;
int
ai
=
mrb_gc_arena_save
(
s
->
mrb
);
int
sym
=
new_sym
(
s
,
mrb_intern_lit
(
s
->
mrb
,
REGEXP_CLASS
));
int
off
=
new_lit
(
s
,
mrb_str_new
(
s
->
mrb
,
p1
,
strlen
(
p1
)
));
int
off
=
new_lit
(
s
,
mrb_str_new
_cstr
(
s
->
mrb
,
p1
));
int
argc
=
1
;
genop
(
s
,
MKOP_A
(
OP_OCLASS
,
cursp
()));
...
...
@@ -2116,7 +2116,7 @@ codegen(codegen_scope *s, node *tree, int val)
genop
(
s
,
MKOP_ABx
(
OP_STRING
,
cursp
(),
off
));
if
(
p2
)
{
push
();
off
=
new_lit
(
s
,
mrb_str_new
(
s
->
mrb
,
p2
,
strlen
(
p2
)
));
off
=
new_lit
(
s
,
mrb_str_new
_cstr
(
s
->
mrb
,
p2
));
genop
(
s
,
MKOP_ABx
(
OP_STRING
,
cursp
(),
off
));
argc
++
;
pop
();
...
...
@@ -2153,7 +2153,7 @@ codegen(codegen_scope *s, node *tree, int val)
n
=
tree
->
cdr
->
cdr
;
if
(
n
->
car
)
{
p
=
(
char
*
)
n
->
car
;
off
=
new_lit
(
s
,
mrb_str_new
(
s
->
mrb
,
p
,
strlen
(
p
)
));
off
=
new_lit
(
s
,
mrb_str_new
_cstr
(
s
->
mrb
,
p
));
codegen
(
s
,
tree
->
car
,
VAL
);
genop
(
s
,
MKOP_ABx
(
OP_STRING
,
cursp
(),
off
));
pop
();
...
...
@@ -2164,7 +2164,7 @@ codegen(codegen_scope *s, node *tree, int val)
int
off
;
push
();
off
=
new_lit
(
s
,
mrb_str_new
(
s
->
mrb
,
p2
,
strlen
(
p2
)
));
off
=
new_lit
(
s
,
mrb_str_new
_cstr
(
s
->
mrb
,
p2
));
genop
(
s
,
MKOP_ABx
(
OP_STRING
,
cursp
(),
off
));
argc
++
;
pop
();
...
...
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