Graphviz 12.0.1~dev.20240715.2254
Loading...
Searching...
No Matches
utils.c
Go to the documentation of this file.
1
6/*************************************************************************
7 * Copyright (c) 2011 AT&T Intellectual Property
8 * All rights reserved. This program and the accompanying materials
9 * are made available under the terms of the Eclipse Public License v1.0
10 * which accompanies this distribution, and is available at
11 * https://www.eclipse.org/legal/epl-v10.html
12 *
13 * Contributors: Details at https://graphviz.org
14 *************************************************************************/
15
16#include <cgraph/cghdr.h>
17#include <stddef.h>
18
20
21void agdictobjfree(void *p) {
23 if (g)
24 agfree(g, p);
25 else
26 free(p);
27}
28
30{
31 Dict_t *d;
32
33 Ag_dictop_G = g;
34 d = dtopen(disc, method);
36 return d;
37}
38
39int agdtdelete(Agraph_t * g, Dict_t * dict, void *obj)
40{
41 Ag_dictop_G = g;
42 return dtdelete(dict, obj) != NULL;
43}
44
45int agdtclose(Agraph_t * g, Dict_t * dict)
46{
47 dtdisc(dict, NULL);
48 Ag_dictop_G = g;
49 if (dtclose(dict))
50 return 1;
52 return 0;
53}
54
55void agdtdisc(Agraph_t * g, Dict_t * dict, Dtdisc_t * disc)
56{
57 (void)g; /* unused */
58 if (disc && dtdisc(dict, NULL) != disc) {
59 dtdisc(dict, disc);
60 }
61 /* else unchanged, disc is same as old disc */
62}
CDT_API int dtclose(Dt_t *)
Definition dtclose.c:8
#define dtdelete(d, o)
Definition cdt.h:194
CDT_API Dtdisc_t * dtdisc(Dt_t *dt, Dtdisc_t *)
Definition dtdisc.c:11
CDT_API Dt_t * dtopen(Dtdisc_t *, Dtmethod_t *)
Definition dtopen.c:9
cgraph.h additions
void agdtdisc(Agraph_t *g, Dict_t *dict, Dtdisc_t *disc)
Definition utils.c:55
Dict_t * agdtopen(Agraph_t *g, Dtdisc_t *disc, Dtmethod_t *method)
Definition utils.c:29
int agdtdelete(Agraph_t *g, Dict_t *dict, void *obj)
Definition utils.c:39
void agdictobjfree(void *p)
Definition utils.c:21
static Agraph_t * Ag_dictop_G
Definition utils.c:19
int agdtclose(Agraph_t *g, Dict_t *dict)
Definition utils.c:45
void free(void *)
node NULL
Definition grammar.y:149
void agfree(Agraph_t *g, void *ptr)
Definition mem.c:49
graph or subgraph
Definition cgraph.h:425
Definition cdt.h:104