summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorMasaki Muranaka <[email protected]>2013-03-29 16:26:00 +0900
committerMasaki Muranaka <[email protected]>2013-03-29 16:26:00 +0900
commit2b6e9ee556fabebf732ba24fe1de2250b6a6dda2 (patch)
tree70a0fad38f259f4e5317fd9ab7b47e126b0ff637 /src
parentc67aec25b6aeb4191b695a197eb3835b83d81886 (diff)
downloadmruby-2b6e9ee556fabebf732ba24fe1de2250b6a6dda2.tar.gz
mruby-2b6e9ee556fabebf732ba24fe1de2250b6a6dda2.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/codegen.c2
-rw-r--r--src/load.c4
2 files changed, 3 insertions, 3 deletions
diff --git a/src/codegen.c b/src/codegen.c
index cff3b3ce4..e5b1802a1 100644
--- a/src/codegen.c
+++ b/src/codegen.c
@@ -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;
diff --git a/src/load.c b/src/load.c
index c58dde4ce..66182e10f 100644
--- a/src/load.c
+++ b/src/load.c
@@ -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