summaryrefslogtreecommitdiff
path: root/lineset.c
diff options
context:
space:
mode:
authorKatolaZ <katolaz@freaknet.org>2019-08-05 08:06:19 +0100
committerKatolaZ <katolaz@freaknet.org>2019-08-05 08:06:19 +0100
commit9127db5e322c1b0cd57adf90e8cfefad66020fe2 (patch)
treea654d8c13225cb91a22d34626047a5c9eb24fa4f /lineset.c
parent6bf74b8e63315aeeac6fe4307e9e2679d334aca3 (diff)
remove atexit and replace exit() with cleanup()
Diffstat (limited to 'lineset.c')
-rw-r--r--lineset.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/lineset.c b/lineset.c
index 349504c..47c3de4 100644
--- a/lineset.c
+++ b/lineset.c
@@ -14,7 +14,7 @@ void ensure_line_length(line_t *l, int len){
tmp = realloc(l->s, (len+1) * 2 * sizeof(char));
if (!tmp){
fprintf(stderr, "Unable to allocate string\n");
- exit(1);
+ cleanup(-1);
}
l->s = tmp;
l->sz = (len + 1) * 2;
@@ -29,7 +29,7 @@ void alloc_line(line_t *l){
tmp = malloc((l->sz) * sizeof(char));
if (tmp == NULL){
fprintf(stderr, "unable to allocate line\n");
- exit(1);
+ cleanup(-1);
}
l->s = tmp;
memset(l->s, BG, l->sz);
@@ -46,7 +46,7 @@ void ensure_num_lines(lineset_t *ls, int n){
tmp = realloc(ls->l, (n + LONG_STEP) * sizeof(line_t));
if (tmp == NULL){
fprintf(stderr, "Unable to allocate memory for more lines");
- exit(1);
+ cleanup(-1);
}
else {
ls->l = tmp;
@@ -147,7 +147,7 @@ void copy_lines_to_ring(int y1, int y2, int which){
tmp = realloc(undo, (undo_sz + 10) * sizeof(lineset_t));
if (tmp == NULL){
fprintf(stderr, "Error allocating undo buffer");
- exit(1);
+ cleanup(-1);
}
undo = tmp;
for (i=0; i<10; i++){