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
08e6bd47
Commit
08e6bd47
authored
Nov 13, 2013
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fclose input file
parent
ca704e54
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
3 deletions
+9
-3
tools/mrbc/mrbc.c
tools/mrbc/mrbc.c
+9
-3
No files found.
tools/mrbc/mrbc.c
View file @
08e6bd47
...
@@ -187,6 +187,7 @@ load_file(mrb_state *mrb, struct mrbc_args *args)
...
@@ -187,6 +187,7 @@ load_file(mrb_state *mrb, struct mrbc_args *args)
mrb_value
result
;
mrb_value
result
;
char
*
input
=
args
->
argv
[
args
->
idx
];
char
*
input
=
args
->
argv
[
args
->
idx
];
FILE
*
infile
;
FILE
*
infile
;
int
need_close
=
FALSE
;
c
=
mrbc_context_new
(
mrb
);
c
=
mrbc_context_new
(
mrb
);
if
(
args
->
verbose
)
if
(
args
->
verbose
)
...
@@ -195,17 +196,22 @@ load_file(mrb_state *mrb, struct mrbc_args *args)
...
@@ -195,17 +196,22 @@ load_file(mrb_state *mrb, struct mrbc_args *args)
if
(
input
[
0
]
==
'-'
&&
input
[
1
]
==
'\0'
)
{
if
(
input
[
0
]
==
'-'
&&
input
[
1
]
==
'\0'
)
{
infile
=
stdin
;
infile
=
stdin
;
}
}
else
if
((
infile
=
fopen
(
input
,
"r"
))
==
NULL
)
{
else
{
fprintf
(
stderr
,
"%s: cannot open program file. (%s)
\n
"
,
args
->
prog
,
input
);
need_close
=
TRUE
;
return
mrb_nil_value
();
if
((
infile
=
fopen
(
input
,
"r"
))
==
NULL
)
{
fprintf
(
stderr
,
"%s: cannot open program file. (%s)
\n
"
,
args
->
prog
,
input
);
return
mrb_nil_value
();
}
}
}
mrbc_filename
(
mrb
,
c
,
input
);
mrbc_filename
(
mrb
,
c
,
input
);
args
->
idx
++
;
args
->
idx
++
;
if
(
args
->
idx
<
args
->
argc
)
{
if
(
args
->
idx
<
args
->
argc
)
{
need_close
=
FALSE
;
mrbc_partial_hook
(
mrb
,
c
,
partial_hook
,
(
void
*
)
args
);
mrbc_partial_hook
(
mrb
,
c
,
partial_hook
,
(
void
*
)
args
);
}
}
result
=
mrb_load_file_cxt
(
mrb
,
infile
,
c
);
result
=
mrb_load_file_cxt
(
mrb
,
infile
,
c
);
if
(
need_close
)
fclose
(
infile
);
if
(
mrb_undef_p
(
result
)
||
mrb_fixnum
(
result
)
<
0
)
{
if
(
mrb_undef_p
(
result
)
||
mrb_fixnum
(
result
)
<
0
)
{
mrbc_context_free
(
mrb
,
c
);
mrbc_context_free
(
mrb
,
c
);
return
mrb_nil_value
();
return
mrb_nil_value
();
...
...
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