comparison ui.c @ 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 ff1af7410bba
comparison
equal deleted inserted replaced
700:f3ec1cb11cea 701:f3b119599b3a
26 } 26 }
27 27
28 28
29 static nn_window_t *nn_window_new(const char *id) 29 static nn_window_t *nn_window_new(const char *id)
30 { 30 {
31 nn_window_t *res = th_malloc0(sizeof(nn_window_t)); 31 nn_window_t *win;
32 32
33 if (res == NULL) return NULL; 33 if ((win = th_malloc0(sizeof(nn_window_t))) == NULL)
34
35 res->data = th_ringbuf_new(SET_BACKBUF_LEN, nn_line_free);
36 if (res->data == NULL)
37 {
38 th_free(res);
39 return NULL; 34 return NULL;
40 } 35
41 36 win->data = th_ringbuf_new(SET_BACKBUF_LEN, nn_line_free);
42 res->id = th_strdup(id); 37 if (win->data == NULL)
43 38 {
44 return res; 39 th_free(win);
40 return NULL;
41 }
42
43 win->id = th_strdup(id);
44
45 return win;
45 } 46 }
46 47
47 48
48 static void nn_window_free(nn_window_t *win) 49 static void nn_window_free(nn_window_t *win)
49 { 50 {