mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
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.
This commit is contained in:
@@ -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;
|
||||
|
||||
+1
-1
@@ -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;
|
||||
|
||||
+2
-2
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user