summaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
authorh2so5 <[email protected]>2013-04-10 06:02:45 +0900
committerh2so5 <[email protected]>2013-04-10 06:39:52 +0900
commitf44c99cd2d62e56171f58fb385a901ffef2d9a0e (patch)
tree84ea2e2cc6c794a70807984f159067d06f36bd02 /tools
parentab6c9c186b6900d8f694bf2029cadea303f72f19 (diff)
downloadmruby-f44c99cd2d62e56171f58fb385a901ffef2d9a0e.tar.gz
mruby-f44c99cd2d62e56171f58fb385a901ffef2d9a0e.zip
Replace malloc with mrb_malloc in mrbc
Diffstat (limited to 'tools')
-rw-r--r--tools/mrbc/mrbc.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/tools/mrbc/mrbc.c b/tools/mrbc/mrbc.c
index cb4de6d2a..4e17d6890 100644
--- a/tools/mrbc/mrbc.c
+++ b/tools/mrbc/mrbc.c
@@ -47,12 +47,12 @@ usage(const char *name)
}
static char *
-get_outfilename(char *infile, char *ext)
+get_outfilename(mrb_state *mrb, char *infile, char *ext)
{
char *outfile;
char *p;
- outfile = (char*)malloc(strlen(infile) + strlen(ext) + 1);
+ outfile = (char*)mrb_malloc(mrb, strlen(infile) + strlen(ext) + 1);
strcpy(outfile, infile);
if (*ext) {
if ((p = strrchr(outfile, '.')) == NULL)
@@ -91,7 +91,7 @@ parse_args(mrb_state *mrb, int argc, char **argv, struct _args *args)
result = EXIT_FAILURE;
goto exit;
}
- outfile = get_outfilename((*argv) + 2, "");
+ outfile = get_outfilename(mrb, (*argv) + 2, "");
break;
case 'B':
args->ext = C_EXT;
@@ -150,7 +150,7 @@ parse_args(mrb_state *mrb, int argc, char **argv, struct _args *args)
outfile = infile;
}
else {
- outfile = get_outfilename(infile, args->ext);
+ outfile = get_outfilename(mrb, infile, args->ext);
}
}
if (strcmp("-", outfile) == 0) {
@@ -163,7 +163,7 @@ parse_args(mrb_state *mrb, int argc, char **argv, struct _args *args)
}
}
exit:
- if (outfile && infile != outfile) free(outfile);
+ if (outfile && infile != outfile) mrb_free(mrb, outfile);
return result;
}