From: Matthew Fernandez Date: Mon, 10 Jan 2022 00:43:32 +0000 (-0800) Subject: mapbool: return a C99 bool instead of a boolean X-Git-Tag: 3.0.0~79^2~6 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ab293268b54a9f43ab65f126e3aa80d15abaa7fa;p=graphviz mapbool: return a C99 bool instead of a boolean --- diff --git a/lib/common/input.c b/lib/common/input.c index 881cc3146..46310d829 100644 --- a/lib/common/input.c +++ b/lib/common/input.c @@ -711,19 +711,19 @@ void graph_init(graph_t * g, bool use_rankdir) getdoubles2ptf(g, "size", &GD_drawing(g)->size) ? TRUE : FALSE; getdoubles2ptf(g, "page", &(GD_drawing(g)->page)); - GD_drawing(g)->centered = mapbool(agget(g, "center")); + GD_drawing(g)->centered = mapbool(agget(g, "center")) ? TRUE : FALSE; if ((p = agget(g, "rotate"))) GD_drawing(g)->landscape = atoi(p) == 90; else if ((p = agget(g, "orientation"))) GD_drawing(g)->landscape = p[0] == 'l' || p[0] == 'L'; else if ((p = agget(g, "landscape"))) - GD_drawing(g)->landscape = mapbool(p); + GD_drawing(g)->landscape = mapbool(p) ? TRUE : FALSE; p = agget(g, "clusterrank"); CL_type = maptoken(p, rankname, rankcode); p = agget(g, "concentrate"); - Concentrate = mapbool(p); + Concentrate = mapbool(p) ? TRUE : FALSE; State = GVBEGIN; EdgeLabelsDone = 0; diff --git a/lib/common/shapes.c b/lib/common/shapes.c index ae3755f7a..5e09a4880 100644 --- a/lib/common/shapes.c +++ b/lib/common/shapes.c @@ -1858,7 +1858,7 @@ static void poly_init(node_t * n) orientation = ND_shape(n)->polygon->orientation; skew = ND_shape(n)->polygon->skew; distortion = ND_shape(n)->polygon->distortion; - regular |= mapbool(agget(n, "regular")); + regular |= mapbool(agget(n, "regular")) ? TRUE : FALSE; /* all calculations in floating point POINTS */ @@ -3551,7 +3551,8 @@ static void record_init(node_t * n) sz.x = MAX(info->size.x, sz.x); sz.y = MAX(info->size.y, sz.y); } - resize_reclbl(info, sz, mapbool(late_string(n, N_nojustify, "false"))); + resize_reclbl(info, sz, + mapbool(late_string(n, N_nojustify, "false")) ? TRUE : FALSE); ul = pointfof(-sz.x / 2., sz.y / 2.); /* FIXME - is this still true: suspected to introduce ronding error - see Kluge below */ pos_reclbl(info, ul, sides); ND_width(n) = PS2INCH(info->size.x); diff --git a/lib/common/utils.c b/lib/common/utils.c index bad4ac1ed..59dedf453 100644 --- a/lib/common/utils.c +++ b/lib/common/utils.c @@ -140,7 +140,7 @@ bool late_bool(void *obj, attrsym_t * attr, bool def) if (attr == NULL) return def; - return mapbool(agxget(obj, attr)) != FALSE; + return mapbool(agxget(obj, attr)); } /* union-find */ @@ -460,9 +460,9 @@ bool mapBool(const char *p, bool dflt) return dflt; } -boolean mapbool(char *p) +bool mapbool(char *p) { - return mapBool(p, false) ? TRUE : FALSE; + return mapBool(p, false); } pointf dotneato_closest(splines * spl, pointf pt) @@ -703,7 +703,7 @@ int common_init_edge(edge_t * e) fi.fontsize, fi.fontname, fi.fontcolor); GD_has_labels(sg) |= EDGE_LABEL; ED_label_ontop(e) = - mapbool(late_string(e, E_label_float, "false")); + mapbool(late_string(e, E_label_float, "false")) ? TRUE : FALSE; } if (E_xlabel && (str = agxget(e, E_xlabel)) && (str[0])) { diff --git a/lib/common/utils.h b/lib/common/utils.h index 1aab596c2..24bbd3954 100644 --- a/lib/common/utils.h +++ b/lib/common/utils.h @@ -89,7 +89,7 @@ UTILS_API char *Fgets(FILE *fp); UTILS_API const char *safefile(const char *filename); UTILS_API bool mapBool(const char*, bool); -UTILS_API boolean mapbool(char *); +UTILS_API bool mapbool(char *); UTILS_API int maptoken(char *, char **, int *); UTILS_API bool findStopColor(char *colorlist, char *clrs[2], float *frac); diff --git a/lib/dotgen/class1.c b/lib/dotgen/class1.c index 06322a11e..c7a0c5824 100644 --- a/lib/dotgen/class1.c +++ b/lib/dotgen/class1.c @@ -22,7 +22,7 @@ int nonconstraint_edge(edge_t * e) char *constr; if (E_constr && (constr = agxget(e, E_constr))) { - if (constr[0] && mapbool(constr) == FALSE) + if (constr[0] && !mapbool(constr)) return TRUE; } return FALSE; diff --git a/lib/dotgen/rank.c b/lib/dotgen/rank.c index 4958425da..9e132e225 100644 --- a/lib/dotgen/rank.c +++ b/lib/dotgen/rank.c @@ -637,7 +637,7 @@ static int is_nonconstraint(edge_t * e) char *constr; if (E_constr && (constr = agxget(e, E_constr))) { - if (constr[0] && mapbool(constr) == FALSE) + if (constr[0] && !mapbool(constr)) return TRUE; } return FALSE; diff --git a/lib/gvc/gvrender.c b/lib/gvc/gvrender.c index 8208de69b..6e80b5fd4 100644 --- a/lib/gvc/gvrender.c +++ b/lib/gvc/gvrender.c @@ -33,7 +33,7 @@ extern int emit_once(char *str); extern shape_desc *find_user_shape(char *name); -extern boolean mapbool(char *s); +extern bool mapbool(char *s); int gvrender_select(GVJ_t * job, const char *str) { diff --git a/plugin/gd/gvrender_gd.c b/plugin/gd/gvrender_gd.c index e4083bf6b..c536b20fb 100644 --- a/plugin/gd/gvrender_gd.c +++ b/plugin/gd/gvrender_gd.c @@ -33,7 +33,7 @@ typedef enum { FORMAT_XBM, } format_type; -extern boolean mapbool(char *); +extern bool mapbool(char *); extern pointf Bezier(pointf * V, int degree, double t, pointf * Left, pointf * Right); #define BEZIERSUBDIVISION 10 @@ -74,7 +74,7 @@ static void gdgen_begin_page(GVJ_t * job) bgcolor_str = agget(job->gvc->g, "bgcolor"); if (truecolor_str && truecolor_str[0]) - truecolor_p = mapbool(truecolor_str) != FALSE; + truecolor_p = mapbool(truecolor_str); if (bgcolor_str && strcmp(bgcolor_str, "transparent") == 0) { if (job->render.features->flags & GVDEVICE_DOES_TRUECOLOR)