Line data Source code
1 : #include "../../burp.h"
2 : #include "win.h"
3 : #include "rconf.h"
4 : #include "../../alloc.h"
5 :
6 1 : struct win *win_alloc(struct rconf *rconf)
7 : {
8 1 : struct win *win=NULL;
9 3 : if(!(win=(struct win *)calloc_w(1, sizeof(struct win), __func__))
10 4 : || !(win->data=(char *)calloc_w(
11 2 : 1, sizeof(char)*rconf->win_size, __func__)))
12 0 : win_free(&win);
13 1 : return win;
14 : }
15 :
16 1 : static void win_free_content(struct win *win)
17 : {
18 2 : if(!win) return;
19 1 : free_w(&win->data);
20 : }
21 :
22 1 : void win_free(struct win **win)
23 : {
24 2 : if(!win || !*win) return;
25 1 : win_free_content(*win);
26 1 : free_v((void **)win);
27 : }
|