]> granicus.if.org Git - graphviz/commitdiff
mapbool: return a C99 bool instead of a boolean
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Mon, 10 Jan 2022 00:43:32 +0000 (16:43 -0800)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Mon, 10 Jan 2022 15:51:35 +0000 (07:51 -0800)
lib/common/input.c
lib/common/shapes.c
lib/common/utils.c
lib/common/utils.h
lib/dotgen/class1.c
lib/dotgen/rank.c
lib/gvc/gvrender.c
plugin/gd/gvrender_gd.c

index 881cc314616bdef8a6d5fed60e984562146f6ab0..46310d8290c3fa875c857e54af53a487b48a700c 100644 (file)
@@ -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;
 
index ae3755f7abdbbcb17ad886c16fa4d05f74d7ef7f..5e09a48808b982c47c5cc1948660fc751c922feb 100644 (file)
@@ -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);
index bad4ac1ed22a4a0a6cef65749418c7fa79afb665..59dedf4538183a6db4f9091567c932c729f64ec2 100644 (file)
@@ -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])) {
index 1aab596c212ada014562ce287b1c5f54994dc28b..24bbd39548120143a0697733689f9cd0c310a651 100644 (file)
@@ -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);
index 06322a11e0a61822c3a9e07331cde9a6df039c4d..c7a0c58247d7e25b23d626d39488354bd953f673 100644 (file)
@@ -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;
index 4958425daa52ed0d10b059430dd757d2f315d896..9e132e225f32f3975f533df939db4d51ff22e3fb 100644 (file)
@@ -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;
index 8208de69bd661b264420e137fb8b6cf7ea07e7c7..6e80b5fd4aed883735074e1a7dc4a4adb6977ce1 100644 (file)
@@ -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)
 {
index e4083bf6b2c82169f8cdf1606d1b18af09f3b7c3..c536b20fb49d3ca82280e145966f34f77b3ae212 100644 (file)
@@ -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)