diff options
| author | Louis Burda <quent.burda@gmail.com> | 2023-01-12 15:50:56 +0100 |
|---|---|---|
| committer | Louis Burda <quent.burda@gmail.com> | 2023-01-12 15:50:56 +0100 |
| commit | 099002715d30af646d4582ac2b14322dae3f04d9 (patch) | |
| tree | 459d79b4e9121e5b6d84eea757cc17400366f075 /src/history.c | |
| parent | 44070fb5518e2b54748d58da5a5c61f476ef8700 (diff) | |
| download | tmus-099002715d30af646d4582ac2b14322dae3f04d9.tar.gz tmus-099002715d30af646d4582ac2b14322dae3f04d9.zip | |
Refactor error handling
Diffstat (limited to 'src/history.c')
| -rw-r--r-- | src/history.c | 5 |
1 files changed, 2 insertions, 3 deletions
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 <err.h> #include <string.h> 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'; } |
