Commit 7cc66cf8 authored by Yukihiro "Matz" Matsumoto's avatar Yukihiro "Matz" Matsumoto

Merge pull request #1252 from carsonmcdonald/fixfilenames

Fix for issue 1243
parents 17f10b05 87eb57b6
......@@ -25,6 +25,11 @@ MRuby::Build.new do |conf|
# cc.compile_options = "%{flags} -MMD -o %{outfile} -c %{infile}"
# end
# mrbc settings
# conf.mrbc do |mrbc|
# mrbc.compile_options = "-g -B%{funcname} -o- -" # The -g option is required for line numbers
# end
# Linker settings
# conf.linker do |linker|
# linker.command = ENV['LD'] || 'gcc'
......
......@@ -2403,6 +2403,8 @@ scope_finish(codegen_scope *s)
{
mrb_state *mrb = s->mrb;
mrb_irep *irep = s->irep;
size_t fname_len;
char *fname;
irep->flags = 0;
if (s->iseq) {
......@@ -2418,7 +2420,11 @@ scope_finish(codegen_scope *s)
irep->pool = (mrb_value *)codegen_realloc(s, irep->pool, sizeof(mrb_value)*irep->plen);
irep->syms = (mrb_sym *)codegen_realloc(s, irep->syms, sizeof(mrb_sym)*irep->slen);
if (s->filename) {
irep->filename = s->filename;
fname_len = strlen(s->filename);
fname = codegen_malloc(s, fname_len + 1);
memcpy(fname, s->filename, fname_len);
fname[fname_len] = '\0';
irep->filename = fname;
}
irep->nlocals = s->nlocals;
......
......@@ -267,9 +267,6 @@ read_rite_lineno_record(mrb_state *mrb, const uint8_t *bin, size_t irepno, uint3
mrb->irep[irepno]->lines = lines;
error_exit:
if (fname) {
mrb_free(mrb, fname);
}
return ret;
}
......
......@@ -101,6 +101,7 @@ mrb_irep_free(mrb_state *mrb, struct mrb_irep *irep)
mrb_free(mrb, irep->iseq);
mrb_free(mrb, irep->pool);
mrb_free(mrb, irep->syms);
mrb_free(mrb, (void *)irep->filename);
mrb_free(mrb, irep->lines);
mrb_free(mrb, irep);
}
......
......@@ -236,6 +236,8 @@ module MRuby
end
class Command::Mrbc < Command
attr_accessor :compile_options
def initialize(build)
super
@command = nil
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment