From 35cd2a2914b36b6aea6ccfab693bb8ec6d4206c0 Mon Sep 17 00:00:00 2001 From: Jfreegman Date: Thu, 12 Sep 2013 01:33:41 -0400 Subject: [PATCH] endwin needs to come first --- src/chat.c | 4 ++-- src/friendlist.c | 2 +- src/main.c | 8 ++++---- src/prompt.c | 4 ++-- src/windows.c | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/chat.c b/src/chat.c index 488c31a..fd1b885 100644 --- a/src/chat.c +++ b/src/chat.c @@ -153,8 +153,8 @@ static uint8_t *wcs_to_char(wchar_t *string) } if (ret == NULL) { - fprintf(stderr, "malloc() failed. Aborting...\n"); endwin(); + fprintf(stderr, "malloc() failed. Aborting...\n"); exit(EXIT_FAILURE); } @@ -548,8 +548,8 @@ ToxWindow new_chat(Tox *m, ToxWindow *prompt, int friendnum) ret.x = x; ret.s = s; } else { - fprintf(stderr, "calloc() failed. Aborting...\n"); endwin(); + fprintf(stderr, "calloc() failed. Aborting...\n"); exit(EXIT_FAILURE); } diff --git a/src/friendlist.c b/src/friendlist.c index b831959..79f91bf 100644 --- a/src/friendlist.c +++ b/src/friendlist.c @@ -134,9 +134,9 @@ static void select_friend(Tox *m, wint_t key) } else return; /* Bad key input */ /* If we reach this something is wrong */ - fprintf(stderr, "select_friend() failed. Aborting...\n"); endwin(); tox_kill(m); + fprintf(stderr, "select_friend() failed. Aborting...\n"); exit(EXIT_FAILURE); } diff --git a/src/main.c b/src/main.c index 4555789..c5d9d83 100644 --- a/src/main.c +++ b/src/main.c @@ -317,17 +317,17 @@ static void load_data(Tox *m, char *path) buf = malloc(len); if (buf == NULL) { - fprintf(stderr, "malloc() failed. Aborting...\n"); fclose(fd); endwin(); + fprintf(stderr, "malloc() failed. Aborting...\n"); exit(EXIT_FAILURE); } if (fread(buf, len, 1, fd) != 1) { - fprintf(stderr, "fread() failed. Aborting...\n"); free(buf); fclose(fd); endwin(); + fprintf(stderr, "fread() failed. Aborting...\n"); exit(EXIT_FAILURE); } @@ -347,8 +347,8 @@ static void load_data(Tox *m, char *path) int st; if ((st = store_data(m, path)) != 0) { - fprintf(stderr, "Store messenger failed with return code: %d\n", st); endwin(); + fprintf(stderr, "Store messenger failed with return code: %d\n", st); exit(EXIT_FAILURE); } } @@ -408,8 +408,8 @@ int main(int argc, char *argv[]) strcat(SRVLIST_FILE, CONFIGDIR); strcat(SRVLIST_FILE, "DHTservers"); } else { - fprintf(stderr, "malloc() failed. Aborting...\n"); endwin(); + fprintf(stderr, "malloc() failed. Aborting...\n"); exit(EXIT_FAILURE); } } diff --git a/src/prompt.c b/src/prompt.c index e581f55..420bfef 100644 --- a/src/prompt.c +++ b/src/prompt.c @@ -115,8 +115,8 @@ unsigned char *hex_string_to_bin(char hex_string[]) unsigned char *val = malloc(len); if (val == NULL) { - fprintf(stderr, "malloc() failed. Aborting...\n"); endwin(); + fprintf(stderr, "malloc() failed. Aborting...\n"); exit(EXIT_FAILURE); } @@ -699,8 +699,8 @@ ToxWindow new_prompt() if (s != NULL) ret.s = s; else { - fprintf(stderr, "calloc() failed. Aborting...\n"); endwin(); + fprintf(stderr, "calloc() failed. Aborting...\n"); exit(EXIT_FAILURE); } diff --git a/src/windows.c b/src/windows.c index e36a9af..7ff5c8d 100644 --- a/src/windows.c +++ b/src/windows.c @@ -195,8 +195,8 @@ ToxWindow *init_windows() int n_prompt = add_window(m, new_prompt()); if (n_prompt == -1 || add_window(m, new_friendlist()) == -1) { - fprintf(stderr, "add_window() failed. Aborting...\n"); endwin(); + fprintf(stderr, "add_window() failed. Aborting...\n"); exit(EXIT_FAILURE); }