Commit 2b6e9ee5 authored by Masaki Muranaka's avatar Masaki Muranaka

Modify the type of line-number to uint16_t. Type short is not portable. And it...

Modify the type of line-number to uint16_t. Type short is not portable. And it cannot be more than UINT16_MAX because of the mrbc binary format.
parent c67aec25
......@@ -23,7 +23,7 @@ typedef struct mrb_irep {
/* debug info */
const char *filename;
short *lines;
uint16_t *lines;
size_t ilen, plen, slen;
} mrb_irep;
......
......@@ -2401,7 +2401,7 @@ scope_finish(codegen_scope *s)
irep->iseq = (mrb_code *)codegen_realloc(s, s->iseq, sizeof(mrb_code)*s->pc);
irep->ilen = s->pc;
if (s->lines) {
irep->lines = (short *)codegen_realloc(s, s->lines, sizeof(short)*s->pc);
irep->lines = (uint16_t *)codegen_realloc(s, s->lines, sizeof(uint16_t)*s->pc);
}
else {
irep->lines = 0;
......
......@@ -226,7 +226,7 @@ read_rite_lineno_record(mrb_state *mrb, const uint8_t *bin, size_t irepno, uint3
int ret;
size_t i, fname_len, niseq;
char *fname;
short *lines;
uint16_t *lines;
ret = MRB_DUMP_OK;
*len = 0;
......@@ -249,7 +249,7 @@ read_rite_lineno_record(mrb_state *mrb, const uint8_t *bin, size_t irepno, uint3
bin += sizeof(uint32_t); // niseq
*len += sizeof(uint32_t);
lines = (short *)mrb_malloc(mrb, niseq * sizeof(short));
lines = (uint16_t *)mrb_malloc(mrb, niseq * sizeof(uint16_t));
for (i = 0; i < niseq; i++) {
lines[i] = bin_to_uint16(bin);
bin += sizeof(uint16_t); // niseq
......
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