diff options
author | Leo Tenenbaum <pommicket@gmail.com> | 2019-09-22 21:56:13 -0400 |
---|---|---|
committer | Leo Tenenbaum <pommicket@gmail.com> | 2019-09-22 21:56:13 -0400 |
commit | 215cb46e3c2b3978d593d17fe47a78b6e6a08082 (patch) | |
tree | 13260e5de19d1106c3730efecc7a52217d2db6a5 | |
parent | 4e643262b9da12e0e471a64a72d5761e4e3bb3c8 (diff) |
malloc => err_malloc
-rw-r--r-- | eval.c | 2 | ||||
-rw-r--r-- | identifiers.c | 2 | ||||
-rw-r--r-- | tokenizer.c | 2 | ||||
-rw-r--r-- | types.c | 2 | ||||
-rw-r--r-- | util/arr.c | 2 | ||||
-rw-r--r-- | util/blockarr.c | 2 |
6 files changed, 6 insertions, 6 deletions
@@ -47,7 +47,7 @@ static bool eval_expr(Expression *e, Value *v) { return true; } case UNARY_ADDRESS: - v->points_to = malloc(sizeof *v->points_to); /* OPTIM */ + v->points_to = err_malloc(sizeof *v->points_to); /* OPTIM */ return eval_expr(e->unary.of, v->points_to); case UNARY_DEREF: { Value ptr; diff --git a/identifiers.c b/identifiers.c index 6e993f2..168bf7b 100644 --- a/identifiers.c +++ b/identifiers.c @@ -162,7 +162,7 @@ static Identifier ident_get(Identifiers *ids, const char *s) { static char *ident_to_str(Identifier i) { size_t i_len = (size_t)(i->depth / 2); /* length = depth / 2 */ - char *str = malloc(i_len + 1); + char *str = err_malloc(i_len + 1); str += i_len; *str = 0; while (i->parent) { diff --git a/tokenizer.c b/tokenizer.c index 87a6a95..96f62e0 100644 --- a/tokenizer.c +++ b/tokenizer.c @@ -530,7 +530,7 @@ static bool tokenize_string(Tokenizer *t, char *str) { len++; tokr_nextchar(t); } - char *strlit = malloc(len + 1); + char *strlit = err_malloc(len + 1); char *strptr = strlit; tokr_get_location(t, token); tokr_nextchar(t); /* past opening " */ @@ -463,7 +463,7 @@ static bool type_of_expr(Typer *tr, Expression *e) { return false; } t->kind = TYPE_PTR; - t->ptr.of = malloc(sizeof *t->ptr.of); /* OPTIM */ + t->ptr.of = err_malloc(sizeof *t->ptr.of); /* OPTIM */ *t->ptr.of = *of_type; break; case UNARY_DEREF: @@ -13,7 +13,7 @@ static void arr_create(Array *arr, size_t item_sz) { static inline void arr_reserve(Array *arr, size_t n) { arr->cap = n; - arr->data = realloc(arr->data, arr->item_sz * arr->cap); + arr->data = err_realloc(arr->data, arr->item_sz * arr->cap); } diff --git a/util/blockarr.c b/util/blockarr.c index 03d44b2..bdbffd3 100644 --- a/util/blockarr.c +++ b/util/blockarr.c @@ -36,7 +36,7 @@ static void *block_arr_add(BlockArr *arr) { ArrBlock *block; /* no blocks yet / ran out of blocks*/ block = arr_add(&arr->blocks); - block->data = malloc(arr->item_sz << arr->lg_block_sz); + block->data = err_malloc(arr->item_sz << arr->lg_block_sz); block->n = 1; block->last = block->data; return block->data; |