From: Matthew Fernandez Date: Sat, 15 Jan 2022 17:27:39 +0000 (-0800) Subject: API BREAK: return a C99 bool from 'swapEnds instead of a boolean X-Git-Tag: 3.0.0~66^2~19 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4253e6c333f090d068703fabbcec01f87e74651a;p=graphviz API BREAK: return a C99 bool from 'swapEnds instead of a boolean --- diff --git a/CHANGELOG.md b/CHANGELOG.md index be58dcaab..b0df30f6c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,9 +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**: The `swapEnds` and `splineMerge` members of the `splineInfo` + struct must now be pointers to functions returning a C99 `bool`s instead of + Graphviz-specific `boolean`s. - **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/splines.c b/lib/common/splines.c index 6774bc71f..907c536c0 100644 --- a/lib/common/splines.c +++ b/lib/common/splines.c @@ -62,12 +62,13 @@ arrow_clip(edge_t * fe, node_t * hn, bezier * spl, splineInfo * info) { edge_t *e; - int i, j, sflag, eflag; + int i, sflag, eflag; + bool j; for (e = fe; ED_to_orig(e); e = ED_to_orig(e)); if (info->ignoreSwap) - j = 0; + j = false; else j = info->swapEnds(e); arrow_flags(e, &sflag, &eflag); diff --git a/lib/common/types.h b/lib/common/types.h index c6dc9b79f..c2a56b956 100644 --- a/lib/common/types.h +++ b/lib/common/types.h @@ -77,7 +77,7 @@ extern "C" { } port; typedef struct { - boolean(*swapEnds) (edge_t * e); /* Should head and tail be swapped? */ + bool(*swapEnds) (edge_t * e); /* Should head and tail be swapped? */ 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 */ diff --git a/lib/dotgen/dotsplines.c b/lib/dotgen/dotsplines.c index 8d7db1567..16c498bba 100644 --- a/lib/dotgen/dotsplines.c +++ b/lib/dotgen/dotsplines.c @@ -153,17 +153,17 @@ static bool spline_merge(node_t * n) && (ND_in(n).size > 1 || ND_out(n).size > 1); } -static boolean swap_ends_p(edge_t * e) +static bool swap_ends_p(edge_t * e) { while (ED_to_orig(e)) e = ED_to_orig(e); if (ND_rank(aghead(e)) > ND_rank(agtail(e))) - return FALSE; + return false; if (ND_rank(aghead(e)) < ND_rank(agtail(e))) - return TRUE; + return true; if (ND_order(aghead(e)) >= ND_order(agtail(e))) - return FALSE; - return TRUE; + return false; + return true; } static splineInfo sinfo = {.swapEnds = swap_ends_p, diff --git a/lib/neatogen/multispline.c b/lib/neatogen/multispline.c index dc5d1489f..43e66ee88 100644 --- a/lib/neatogen/multispline.c +++ b/lib/neatogen/multispline.c @@ -20,10 +20,10 @@ static bool spline_merge(node_t * n) return false; } -static boolean swap_ends_p(edge_t * e) +static bool swap_ends_p(edge_t * e) { (void)e; - return FALSE; + return false; } static splineInfo sinfo = {.swapEnds = swap_ends_p, diff --git a/lib/neatogen/neatosplines.c b/lib/neatogen/neatosplines.c index b57228359..53fa5c608 100644 --- a/lib/neatogen/neatosplines.c +++ b/lib/neatogen/neatosplines.c @@ -30,10 +30,10 @@ static bool spline_merge(node_t * n) return false; } -static boolean swap_ends_p(edge_t * e) +static bool swap_ends_p(edge_t * e) { (void)e; - return FALSE; + return false; } static splineInfo sinfo = {.swapEnds = swap_ends_p, diff --git a/lib/ortho/ortho.c b/lib/ortho/ortho.c index 807a28d4d..3435e5b6c 100644 --- a/lib/ortho/ortho.c +++ b/lib/ortho/ortho.c @@ -1228,10 +1228,10 @@ static bool spline_merge(node_t * n) return false; } -static boolean swap_ends_p(edge_t * e) +static bool swap_ends_p(edge_t * e) { (void)e; - return FALSE; + return false; } static splineInfo sinfo = { swap_ends_p, spline_merge, 1, 1 };