From bf173b320f21573ff3400eca950b4374661895a6 Mon Sep 17 00:00:00 2001 From: Tatsuhiko Kubo Date: Tue, 26 Aug 2014 08:42:43 +0900 Subject: Remove discareded NULL checks. --- src/dump.c | 3 --- src/gc.c | 4 +--- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/src/dump.c b/src/dump.c index e019baa99..e67eabbc8 100644 --- a/src/dump.c +++ b/src/dump.c @@ -889,9 +889,6 @@ mrb_dump_irep(mrb_state *mrb, mrb_irep *irep, int debug_info, uint8_t **bin, siz section_irep_size + section_lineno_size + section_lv_size + sizeof(struct rite_binary_footer); cur = *bin = (uint8_t*)mrb_malloc(mrb, *bin_size); - if (cur == NULL) { - goto error_exit; - } cur += sizeof(struct rite_binary_header); result = write_section_irep(mrb, irep, cur); diff --git a/src/gc.c b/src/gc.c index 253128a44..c33f1e662 100644 --- a/src/gc.c +++ b/src/gc.c @@ -229,9 +229,7 @@ mrb_calloc(mrb_state *mrb, size_t nelem, size_t len) size = nelem * len; p = mrb_realloc(mrb, 0, size); - if (p) { - memset(p, 0, size); - } + memset(p, 0, size); } else { p = NULL; -- cgit v1.2.3 From cc22ec85b9f1b6bf818fd8d456cc12e1460164c0 Mon Sep 17 00:00:00 2001 From: Tatsuhiko Kubo Date: Tue, 26 Aug 2014 09:05:12 +0900 Subject: Use mrb_malloc() instead of mrb_realloc(). --- src/gc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gc.c b/src/gc.c index c33f1e662..30391a081 100644 --- a/src/gc.c +++ b/src/gc.c @@ -227,7 +227,7 @@ mrb_calloc(mrb_state *mrb, size_t nelem, size_t len) nelem <= SIZE_MAX / len) { size_t size; size = nelem * len; - p = mrb_realloc(mrb, 0, size); + p = mrb_malloc(mrb, size); memset(p, 0, size); } -- cgit v1.2.3