diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2021-07-09 14:10:48 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2021-07-09 14:10:48 +0900 |
| commit | b5039fdb6c746cc77d0b3a499c0cf0baacc4f815 (patch) | |
| tree | f423ca1151b54d7faa0de4b7e1b44198999d17ba /src | |
| parent | 29556a49a0419ba60721efe2b0fa2c9ecff863f7 (diff) | |
| download | mruby-b5039fdb6c746cc77d0b3a499c0cf0baacc4f815.tar.gz mruby-b5039fdb6c746cc77d0b3a499c0cf0baacc4f815.zip | |
debug.h: use `uint8_t` instead of `char` for BER compressed binary.
Diffstat (limited to 'src')
| -rw-r--r-- | src/cdump.c | 2 | ||||
| -rw-r--r-- | src/debug.c | 12 |
2 files changed, 7 insertions, 7 deletions
diff --git a/src/cdump.c b/src/cdump.c index 84cc24ae4..ecc27d9a1 100644 --- a/src/cdump.c +++ b/src/cdump.c @@ -311,7 +311,7 @@ cdump_debug(mrb_state *mrb, const char *name, int n, mrb_irep_debug_info *info, case mrb_debug_line_packed_map: line_type = "mrb_debug_line_packed_map"; fprintf(fp, "static char %s_debug_lines_%d[] = \"", name, n); - char *pmap = info->files[0]->lines.packed_map; + uint8_t *pmap = info->files[0]->lines.packed_map; for (i=0; i<len; i++) { fprintf(fp, "\\x%02x", pmap[i]&0xff); } diff --git a/src/debug.c b/src/debug.c index f41140edf..96c58ed8d 100644 --- a/src/debug.c +++ b/src/debug.c @@ -48,7 +48,7 @@ packed_int_len(uint32_t num) } static size_t -packed_int_encode(uint32_t num, char *p, char *pend) +packed_int_encode(uint32_t num, uint8_t *p, uint8_t *pend) { size_t llen = 0; @@ -64,7 +64,7 @@ packed_int_encode(uint32_t num, char *p, char *pend) } static uint32_t -packed_int_decode(char *p, char **newpos) +packed_int_decode(uint8_t *p, uint8_t **newpos) { size_t i = 0, shift = 0; uint32_t n = 0; @@ -158,8 +158,8 @@ mrb_debug_get_line(mrb_state *mrb, const mrb_irep *irep, uint32_t pc) } case mrb_debug_line_packed_map: { - char *p = f->lines.packed_map; - char *pend = p + f->line_entry_count; + uint8_t *p = f->lines.packed_map; + uint8_t *pend = p + f->line_entry_count; uint32_t pos = 0, line = 0, line_diff; while (p < pend) { pos += packed_int_decode(p, &p); @@ -265,7 +265,7 @@ mrb_debug_info_append_file(mrb_state *mrb, mrb_irep_debug_info *d, uint32_t prev_line = 0; uint32_t prev_pc = 0; size_t packed_size = 0; - char *p, *pend; + uint8_t *p, *pend; for (i = 0; i < file_pc_count; ++i) { if (lines[start_pos + i] == prev_line) { continue; } @@ -275,7 +275,7 @@ mrb_debug_info_append_file(mrb_state *mrb, mrb_irep_debug_info *d, packed_size += packed_int_len(lines[start_pos+i]-prev_line); prev_line = lines[start_pos + i]; } - p = f->lines.packed_map = (char*)mrb_malloc(mrb, packed_size); + p = f->lines.packed_map = (uint8_t*)mrb_malloc(mrb, packed_size); pend = p + packed_size; prev_line = 0; prev_pc = 0; for (i = 0; i < file_pc_count; ++i) { |
