Graphviz 13.0.0~dev.20241220.2304
Loading...
Searching...
No Matches
dtclose.c
Go to the documentation of this file.
1#include <cdt/dthdr.h>
2#include <stdlib.h>
3
4/* Close a dictionary
5**
6** Written by Kiem-Phong Vo (05/25/96)
7*/
8int dtclose(Dt_t* dt)
9{
10 if(!dt || dt->nview > 0 ) /* can't close if being viewed */
11 return -1;
12
13 if(dt->view) /* turn off viewing */
14 dtview(dt,NULL);
15
16 /* release all allocated data */
17 (void)dt->meth->searchf(dt, NULL, DT_CLEAR);
18 if(dtsize(dt) > 0)
19 return -1;
20
21 if (dt->data.ntab > 0)
22 free(dt->data.htab);
23
24 free(dt);
25
26 return 0;
27}
#define DT_CLEAR
Definition cdt.h:132
CDT_API int dtsize(Dt_t *)
Definition dtsize.c:12
CDT_API Dt_t * dtview(Dt_t *, Dt_t *)
Definition dtview.c:91
int dtclose(Dt_t *dt)
Definition dtclose.c:8
void free(void *)
node NULL
Definition grammar.y:163
int ntab
Definition cdt.h:78
Dtsearch_f searchf
Definition cdt.h:66
Definition cdt.h:100
Dtmethod_t * meth
Definition cdt.h:103
Dtdata_t data
sharable data
Definition cdt.h:102
int nview
Definition cdt.h:104
Dt_t * view
Definition cdt.h:105