chiark / gitweb /
Use bool, true, and false in more places
authorBen Harris <bjh21@bjh21.me.uk>
Wed, 10 Jul 2024 09:13:48 +0000 (10:13 +0100)
committerBen Harris <bjh21@bjh21.me.uk>
Wed, 10 Jul 2024 13:47:34 +0000 (14:47 +0100)
There were still places where I was storing booleans in int variables
and explicitly using 0 and 1.

bedstead.c

index d19986437325228d3cd18b79df7dd5e190783d3f..636ca79dcbf104645c0a0b4fe9073461ab70b9e4 100644 (file)
@@ -2613,7 +2613,7 @@ static struct glyph const *glyphs_by_name[NGLYPHS];
 
 static void dolookups(struct glyph const *);
 
-static int
+static bool
 getpix(char const data[YSIZE], int x, int y, unsigned flags)
 {
 
@@ -3150,7 +3150,7 @@ killpoint(point *p)
 
 static vec const zero = { 0, 0 };
 
-static int
+static bool
 vec_eqp(vec v1, vec v2)
 {
        return v1.x == v2.x && v1.y == v2.y;
@@ -3202,7 +3202,7 @@ fix_identical(point *p)
 }
 
 /* Are a, b, and c distinct collinear points in that order? */
-static int
+static bool
 vec_inline3(vec a, vec b, vec c)
 {
        return
@@ -3211,7 +3211,7 @@ vec_inline3(vec a, vec b, vec c)
 }
 
 /* Are a, b, c, and d distinct collinear points in that order? */
-static int
+static bool
 vec_inline4(vec a, vec b, vec c, vec d)
 {
        return vec_inline3(a, b, c) && vec_inline3(b, c, d);
@@ -3234,7 +3234,7 @@ fix_isolated(point *p)
                killpoint(p);
 }
 
-static int done_anything;
+static bool done_anything;
 
 static void
 fix_edges(point *a0, point *b0)
@@ -3259,7 +3259,7 @@ fix_edges(point *a0, point *b0)
                fix_isolated(b0);
                fix_identical(b0);
                fix_collinear(a1);
-               done_anything = 1;
+               done_anything = true;
        }
 }
 
@@ -3269,7 +3269,7 @@ clean_path()
        int i, j;
 
        do {
-               done_anything = 0;
+               done_anything = false;
                for (i = 0; i < nextpoint; i++)
                        for (j = i+1; points[i].next && j < nextpoint; j++)
                                if (points[j].next)
@@ -3384,7 +3384,7 @@ adjust_weight()
 }
 
 static void
-blackpixel(int x, int y, int bl, int br, int tr, int tl)
+blackpixel(int x, int y, bool bl, bool br, bool tr, bool tl)
 {
        x *= XPIX_S; y *= YPIX_S;
 
@@ -3401,7 +3401,7 @@ blackpixel(int x, int y, int bl, int br, int tr, int tl)
 }
 
 static void
-whitepixel(int x, int y, int bl, int br, int tr, int tl)
+whitepixel(int x, int y, bool bl, bool br, bool tr, bool tl)
 {
        x *= XPIX_S; y *= YPIX_S;