From: Ben Harris Date: Wed, 10 Jul 2024 09:13:48 +0000 (+0100) Subject: Use bool, true, and false in more places X-Git-Tag: bedstead-002.007~22 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~bjharris/git?a=commitdiff_plain;h=08bbcb04f66e8bc37920a65b4320faf2d53cb857;p=bedstead.git Use bool, true, and false in more places There were still places where I was storing booleans in int variables and explicitly using 0 and 1. --- diff --git a/bedstead.c b/bedstead.c index d199864..636ca79 100644 --- a/bedstead.c +++ b/bedstead.c @@ -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;