From: Matthew Fernandez Date: Fri, 14 Jan 2022 01:08:48 +0000 (-0800) Subject: API BREAK: remove 'NOT' macro X-Git-Tag: 3.0.0~68^2~5 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e5989b01f4dd17168967c6253455141414bd991d;p=graphviz API BREAK: remove 'NOT' macro --- diff --git a/CHANGELOG.md b/CHANGELOG.md index c92f42c07..8bdcf44e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 symbol to be set to ensure correct linking. - **Breaking**: Graphviz headers no longer define the constant `MAXSHORT`. A drop-in replacement is `SHRT_MAX` in the C standard library’s limits.h. +- **Breaking**: Graphviz headers no longer define the `NOT` macro. A drop-in + replacement is the C/C++ operator `!`. - **Breaking**: Graphviz headers no longer (re-)define the C constants `INT_MIN` and `INT_MAX`. Replacements can be found in the C standard library’s limits.h. - **Breaking**: Graphviz headers no longer define the constant `_DUMMY_ELEM`. diff --git a/lib/cgraph/cgraph.h b/lib/cgraph/cgraph.h index 208037b5b..4d1a5feea 100644 --- a/lib/cgraph/cgraph.h +++ b/lib/cgraph/cgraph.h @@ -35,9 +35,6 @@ extern "C" { #ifndef TRUE #define TRUE (!FALSE) #endif -#ifndef NOT -#define NOT(x) (!(x)) -#endif #ifndef NIL #define NIL(type) ((type)0) #endif diff --git a/lib/cgraph/cmpnd.c b/lib/cgraph/cmpnd.c index ca048fcbe..5434c95e3 100644 --- a/lib/cgraph/cmpnd.c +++ b/lib/cgraph/cmpnd.c @@ -304,7 +304,7 @@ int agexpose(Agnode_t * cmpnode) /* skip if this is not a collapsed subgraph */ noderec = (Agcmpnode_t *) aggetrec(cmpnode, Descriptor_id, FALSE); - if (noderec == NULL || NOT(noderec->collapsed)) + if (noderec == NULL || !noderec->collapsed) return FAILURE; /* undo aghide (above) in reverse order. first, expose subgraph */ @@ -342,7 +342,7 @@ int agexpose(Agnode_t * cmpnode) Agraph_t *agcmpgraph_of(Agnode_t * n) { Agcmpnode_t *noderec = (Agcmpnode_t *) aggetrec(n, Descriptor_id, FALSE); - if (noderec && NOT(noderec->collapsed)) + if (noderec && !noderec->collapsed) return noderec->subg; else return NULL; diff --git a/lib/cgraph/edge.c b/lib/cgraph/edge.c index b27ab6b0b..1676bf366 100644 --- a/lib/cgraph/edge.c +++ b/lib/cgraph/edge.c @@ -270,7 +270,7 @@ Agedge_t *agedge(Agraph_t * g, Agnode_t * t, Agnode_t * h, char *name, int have_id; have_id = agmapnametoid(g, AGEDGE, name, &my_id, FALSE); - if (have_id || (name == NULL && (NOT(cflag) || agisstrict(g)))) { + if (have_id || (name == NULL && (!cflag || agisstrict(g)))) { /* probe for pre-existing edge */ Agtag_t key; key = Tag; diff --git a/lib/cgraph/graph.c b/lib/cgraph/graph.c index a094acd8f..b965b318c 100644 --- a/lib/cgraph/graph.c +++ b/lib/cgraph/graph.c @@ -182,7 +182,7 @@ int agisdirected(Agraph_t * g) int agisundirected(Agraph_t * g) { - return NOT(agisdirected(g)); + return !agisdirected(g); } int agisstrict(Agraph_t * g) diff --git a/lib/cgraph/pend.c b/lib/cgraph/pend.c index a7cf03fda..24f707c13 100644 --- a/lib/cgraph/pend.c +++ b/lib/cgraph/pend.c @@ -258,7 +258,7 @@ static void cb(Dict_t * dict, cb_t callback_kind) static void agrelease_callbacks(Agraph_t * g) { pendingset_t *pending; - if (NOT(g->clos->callbacks_enabled)) { + if (!g->clos->callbacks_enabled) { g->clos->callbacks_enabled = TRUE; pending = agbindrec(g, DRName, sizeof(pendingset_t), false); /* this destroys objects in the opposite of their order of creation */ @@ -278,7 +278,7 @@ static void agrelease_callbacks(Agraph_t * g) int agcallbacks(Agraph_t * g, int flag) { - if (flag && NOT(g->clos->callbacks_enabled)) + if (flag && !g->clos->callbacks_enabled) agrelease_callbacks(g); if (g->clos->callbacks_enabled) { g->clos->callbacks_enabled = flag != 0; diff --git a/lib/cgraph/rec.c b/lib/cgraph/rec.c index c16c1fe68..81f463a11 100644 --- a/lib/cgraph/rec.c +++ b/lib/cgraph/rec.c @@ -77,7 +77,7 @@ static void objputrec(Agobj_t * obj, void *arg) firstrec->next = newrec; } } - if (NOT(obj->tag.mtflock)) + if (!obj->tag.mtflock) set_data(obj, newrec, false); } diff --git a/lib/cgraph/write.c b/lib/cgraph/write.c index d6cd8b23b..902fc0192 100644 --- a/lib/cgraph/write.c +++ b/lib/cgraph/write.c @@ -287,7 +287,7 @@ static int write_hdr(Agraph_t * g, iochan_t * ofile, int top) bool hasName = true; strict = ""; - if (NOT(top) && agparent(g)) + if (!top && agparent(g)) kind = "sub"; else { root = true; @@ -431,7 +431,7 @@ static int write_edge_name(Agedge_t * e, iochan_t * ofile, int terminate) p = agnameof(e); g = agraphof(e); - if (NOT(EMPTY(p))) { + if (!EMPTY(p)) { if (!terminate) { Level++; } @@ -520,7 +520,7 @@ static int write_node(Agnode_t * n, iochan_t * ofile, Dict_t * d) g = agraphof(n); CHKRV(indent(g, ofile)); CHKRV(write_nodename(n, ofile)); - if (NOT(attrs_written(n))) + if (!attrs_written(n)) CHKRV(write_nondefault_attrs(n, ofile, d)); return ioput(g, ofile, ";\n"); } @@ -597,7 +597,7 @@ static int write_edge(Agedge_t * e, iochan_t * ofile, Dict_t * d) CHKRV(ioput(g, ofile, (agisdirected(agraphof(t)) ? " -> " : " -- "))); CHKRV(write_nodename(h, ofile)); CHKRV(write_port(e, ofile, Headport)); - if (NOT(attrs_written(e))) { + if (!attrs_written(e)) { CHKRV(write_nondefault_attrs(e, ofile, d)); } else { CHKRV(write_edge_name(e, ofile, TRUE)); diff --git a/lib/common/logic.h b/lib/common/logic.h index f5e119f2a..b6ea30f41 100644 --- a/lib/common/logic.h +++ b/lib/common/logic.h @@ -16,10 +16,6 @@ extern "C" { #include -#ifndef NOT -#define NOT(v) (!(v)) -#endif - #ifndef FALSE #define FALSE (0) #endif diff --git a/lib/common/ns.c b/lib/common/ns.c index 38738de11..430da327a 100644 --- a/lib/common/ns.c +++ b/lib/common/ns.c @@ -554,7 +554,7 @@ static Agnode_t *treeupdate(Agnode_t * v, Agnode_t * w, int cutvalue, int dir) if (v == agtail(e)) d = dir; else - d = NOT(dir); + d = !dir; if (d) ED_cutvalue(e) += cutvalue; else diff --git a/lib/common/shapes.c b/lib/common/shapes.c index f96a55351..15392b990 100644 --- a/lib/common/shapes.c +++ b/lib/common/shapes.c @@ -3268,7 +3268,7 @@ static field_t *parse_reclbl(node_t * n, int LR, int flag, char *text) if (mode != 0 || !*reclblp) return parse_error(rv, tmpport); mode = HASTABLE; - if (!(rv->fld[fi++] = parse_reclbl(n, NOT(LR), FALSE, text))) + if (!(rv->fld[fi++] = parse_reclbl(n, !LR, FALSE, text))) return parse_error(rv, tmpport); break; case '}': @@ -3523,7 +3523,7 @@ static void record_init(node_t * n) int sides = BOTTOM | RIGHT | TOP | LEFT; /* Always use rankdir to determine how records are laid out */ - flip = NOT(GD_realflip(agraphof(n))); + flip = !GD_realflip(agraphof(n)); reclblp = ND_label(n)->text; len = strlen(reclblp); /* For some forgotten reason, an empty label is parsed into a space, so diff --git a/lib/common/types.h b/lib/common/types.h index 5c5d0cb0f..d7cf6c20d 100644 --- a/lib/common/types.h +++ b/lib/common/types.h @@ -18,14 +18,11 @@ #include typedef unsigned char boolean; -#ifndef NOT -#define NOT(v) (!(v)) -#endif #ifndef FALSE #define FALSE 0 #endif #ifndef TRUE -#define TRUE NOT(FALSE) +#define TRUE (!FALSE) #endif #include "geom.h" diff --git a/lib/dotgen/mincross.c b/lib/dotgen/mincross.c index 4bbe3dfe7..139fc3d98 100644 --- a/lib/dotgen/mincross.c +++ b/lib/dotgen/mincross.c @@ -1218,8 +1218,7 @@ static void flat_search(graph_t * g, node_t * v) hascl = GD_n_cluster(dot_root(g)) > 0; if (ND_flat_out(v).list) for (i = 0; (e = ND_flat_out(v).list[i]); i++) { - if (hascl - && NOT(agcontains(g, agtail(e)) && agcontains(g, aghead(e)))) + if (hascl && !(agcontains(g, agtail(e)) && agcontains(g, aghead(e)))) continue; if (ED_weight(e) == 0) continue; diff --git a/lib/pathplan/pathutil.h b/lib/pathplan/pathutil.h index 99b8ba327..3326cbad3 100644 --- a/lib/pathplan/pathutil.h +++ b/lib/pathplan/pathutil.h @@ -16,12 +16,9 @@ extern "C" { #endif -#ifndef NOT -#define NOT(x) (!(x)) -#endif #ifndef FALSE #define FALSE 0 -#define TRUE (NOT(FALSE)) +#define TRUE (!FALSE) #endif #ifdef GVDLL diff --git a/tclpkg/tclpathplan/tclpathplan.c b/tclpkg/tclpathplan/tclpathplan.c index 609cfd4c1..83eecd95b 100644 --- a/tclpkg/tclpathplan/tclpathplan.c +++ b/tclpkg/tclpathplan/tclpathplan.c @@ -110,7 +110,7 @@ static int vc_refresh(vgpane_t * vgp) obs = malloc(vgp->Npoly * sizeof(Ppoly_t)); for (i = 0; i < vgp->Npoly; i++) obs[i] = &(vgp->poly[i].boundary); - if (NOT(Plegal_arrangement(obs, vgp->Npoly))) + if (!Plegal_arrangement(obs, vgp->Npoly)) fprintf(stderr, "bad arrangement\n"); else vgp->vc = Pobsopen(obs, vgp->Npoly);