Merge pull request #2566 from cubicdaiya/issues/null_check

Remove discareded NULL checks and use mrb_malloc() instead of mrb_realloc().
This commit is contained in:
Yukihiro "Matz" Matsumoto
2014-08-27 23:48:06 +09:00
2 changed files with 2 additions and 7 deletions
-3
View File
@@ -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);
+2 -4
View File
@@ -227,11 +227,9 @@ 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);
if (p) {
memset(p, 0, size);
}
memset(p, 0, size);
}
else {
p = NULL;