Mercurial > hg > nnchat
changeset 701:f3b119599b3a
Slight code cleanup on aisle nn_window_new().
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Fri, 17 Jan 2020 20:04:06 +0200 |
parents | f3ec1cb11cea |
children | 46efb0b16339 |
files | ui.c |
diffstat | 1 files changed, 8 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/ui.c Fri Jan 17 20:03:41 2020 +0200 +++ b/ui.c Fri Jan 17 20:04:06 2020 +0200 @@ -28,20 +28,21 @@ static nn_window_t *nn_window_new(const char *id) { - nn_window_t *res = th_malloc0(sizeof(nn_window_t)); + nn_window_t *win; - if (res == NULL) return NULL; + if ((win = th_malloc0(sizeof(nn_window_t))) == NULL) + return NULL; - res->data = th_ringbuf_new(SET_BACKBUF_LEN, nn_line_free); - if (res->data == NULL) + win->data = th_ringbuf_new(SET_BACKBUF_LEN, nn_line_free); + if (win->data == NULL) { - th_free(res); + th_free(win); return NULL; } - res->id = th_strdup(id); + win->id = th_strdup(id); - return res; + return win; }