From 59b683def4334d722a342af321ac9c4a3605182c Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Sat, 15 Jan 2022 09:19:21 -0800 Subject: [PATCH] API BREAK: return a C99 bool from 'splineMerge' instead of a boolean --- CHANGELOG.md | 3 +++ lib/common/types.h | 2 +- lib/dotgen/dotsplines.c | 12 ++++++------ lib/neatogen/multispline.c | 6 +++--- lib/neatogen/neatosplines.c | 4 ++-- lib/ortho/ortho.c | 4 ++-- 6 files changed, 17 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index acde87af4..be58dcaab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - **Breaking**: The `insidefn` member of the `shape_functions` struct must now be a pointer to a function returning a C99 `bool` instead of a Graphviz-specific `boolean`. +- **Breaking**: The `splineMerge` member of the `splineInfo` struct must now be + a pointer to a function returning a C99 `bool` instead of a Graphviz-specific + `boolean`. - **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 lnger define `NIL` macros. A drop-in diff --git a/lib/common/types.h b/lib/common/types.h index 9d9454b04..c6dc9b79f 100644 --- a/lib/common/types.h +++ b/lib/common/types.h @@ -78,7 +78,7 @@ extern "C" { typedef struct { boolean(*swapEnds) (edge_t * e); /* Should head and tail be swapped? */ - boolean(*splineMerge) (node_t * n); /* Is n a node in the middle of an edge? */ + bool(*splineMerge) (node_t * n); /* Is n a node in the middle of an edge? */ boolean ignoreSwap; /* Test for swapped edges if false */ boolean isOrtho; /* Orthogonal routing used */ } splineInfo; diff --git a/lib/dotgen/dotsplines.c b/lib/dotgen/dotsplines.c index 7c6de0a95..8d7db1567 100644 --- a/lib/dotgen/dotsplines.c +++ b/lib/dotgen/dotsplines.c @@ -147,7 +147,7 @@ getmainedge(edge_t * e) return le; } -static boolean spline_merge(node_t * n) +static bool spline_merge(node_t * n) { return ND_node_type(n) == VIRTUAL && (ND_in(n).size > 1 || ND_out(n).size > 1); @@ -377,7 +377,7 @@ static void _dot_splines(graph_t * g, int normalize) ED_label(fe)->pos = ND_coord(n); ED_label(fe)->set = TRUE; } - if (ND_node_type(n) != NORMAL && sinfo.splineMerge(n) == FALSE) + if (ND_node_type(n) != NORMAL && !sinfo.splineMerge(n)) continue; for (k = 0; (e = ND_out(n).list[k]); k++) { if (ED_edge_type(e) == FLATORDER || ED_edge_type(e) == IGNORED) @@ -1872,7 +1872,7 @@ make_regular_edge(graph_t* g, spline_info_t* sp, path * P, edge_t ** edges, int tn = agtail(e); hn = aghead(e); b = tend.nb = maximal_bbox(g, sp, tn, NULL, e); - beginpath(P, e, REGULAREDGE, &tend, spline_merge(tn) != FALSE); + beginpath(P, e, REGULAREDGE, &tend, spline_merge(tn)); b.UR.y = tend.boxes[tend.boxn - 1].UR.y; b.LL.y = tend.boxes[tend.boxn - 1].LL.y; b = makeregularend(b, BOTTOM, @@ -1899,7 +1899,7 @@ make_regular_edge(graph_t* g, spline_info_t* sp, path * P, edge_t ** edges, int continue; } hend.nb = maximal_bbox(g, sp, hn, e, ND_out(hn).list[0]); - endpath(P, e, REGULAREDGE, &hend, spline_merge(aghead(e)) != FALSE); + endpath(P, e, REGULAREDGE, &hend, spline_merge(aghead(e))); b = makeregularend(hend.boxes[hend.boxn - 1], TOP, ND_coord(hn).y + GD_rank(g)[ND_rank(hn)].ht2); if (b.LL.x < b.UR.x && b.LL.y < b.UR.y) @@ -1943,7 +1943,7 @@ make_regular_edge(graph_t* g, spline_info_t* sp, path * P, edge_t ** edges, int hn = aghead(e); boxes_clear(&boxes); tend.nb = maximal_bbox(g, sp, tn, ND_in(tn).list[0], e); - beginpath(P, e, REGULAREDGE, &tend, spline_merge(tn) != FALSE); + beginpath(P, e, REGULAREDGE, &tend, spline_merge(tn)); b = makeregularend(tend.boxes[tend.boxn - 1], BOTTOM, ND_coord(tn).y - GD_rank(g)[ND_rank(tn)].ht1); if (b.LL.x < b.UR.x && b.LL.y < b.UR.y) @@ -1954,7 +1954,7 @@ make_regular_edge(graph_t* g, spline_info_t* sp, path * P, edge_t ** edges, int boxes_append(&boxes, rank_box(sp, g, ND_rank(tn))); b = hend.nb = maximal_bbox(g, sp, hn, e, NULL); endpath(P, hackflag ? &fwdedgeb.out : e, REGULAREDGE, &hend, - spline_merge(aghead(e)) != FALSE); + spline_merge(aghead(e))); b.UR.y = hend.boxes[hend.boxn - 1].UR.y; b.LL.y = hend.boxes[hend.boxn - 1].LL.y; b = makeregularend(b, TOP, diff --git a/lib/neatogen/multispline.c b/lib/neatogen/multispline.c index 49d5244b6..dc5d1489f 100644 --- a/lib/neatogen/multispline.c +++ b/lib/neatogen/multispline.c @@ -12,12 +12,12 @@ #include #include #include +#include - -static boolean spline_merge(node_t * n) +static bool spline_merge(node_t * n) { (void)n; - return FALSE; + return false; } static boolean swap_ends_p(edge_t * e) diff --git a/lib/neatogen/neatosplines.c b/lib/neatogen/neatosplines.c index 77ed4779e..b57228359 100644 --- a/lib/neatogen/neatosplines.c +++ b/lib/neatogen/neatosplines.c @@ -24,10 +24,10 @@ #endif -static boolean spline_merge(node_t * n) +static bool spline_merge(node_t * n) { (void)n; - return FALSE; + return false; } static boolean swap_ends_p(edge_t * e) diff --git a/lib/ortho/ortho.c b/lib/ortho/ortho.c index 9f447e5da..807a28d4d 100644 --- a/lib/ortho/ortho.c +++ b/lib/ortho/ortho.c @@ -1222,10 +1222,10 @@ static int edgecmp(epair_t* e0, epair_t* e1) return e0->d - e1->d; } -static boolean spline_merge(node_t * n) +static bool spline_merge(node_t * n) { (void)n; - return FALSE; + return false; } static boolean swap_ends_p(edge_t * e) -- 2.40.0