From 099002715d30af646d4582ac2b14322dae3f04d9 Mon Sep 17 00:00:00 2001 From: Louis Burda Date: Thu, 12 Jan 2023 15:50:56 +0100 Subject: Refactor error handling --- src/history.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/history.c') diff --git a/src/history.c b/src/history.c index f9426f1..d11e106 100644 --- a/src/history.c +++ b/src/history.c @@ -3,7 +3,6 @@ #include "history.h" #include "util.h" -#include #include static struct inputln *history_list_prev( @@ -140,7 +139,7 @@ inputln_alloc(void) struct inputln *ln; ln = malloc(sizeof(struct inputln)); - if (!ln) err(1, "malloc"); + if (!ln) ERROR(SYSTEM, "malloc"); inputln_init(ln); return ln; @@ -160,7 +159,7 @@ inputln_resize(struct inputln *ln, size_t size) ln->cap = size; ln->buf = realloc(ln->buf, ln->cap * sizeof(char)); - if (!ln->buf) err(1, "realloc"); + if (!ln->buf) ERROR(SYSTEM, "realloc"); ln->len = MIN(ln->len, ln->cap-1); ln->buf[ln->len] = '\0'; } -- cgit v1.2.3-71-gd317