diff options
| author | Simon Tatham <anakin@pobox.com> | 2018-11-13 21:45:44 +0000 |
|---|---|---|
| committer | Simon Tatham <anakin@pobox.com> | 2018-11-13 21:48:24 +0000 |
| commit | 5f5b284c0bddbe67de14b2d2bfb596bc7ba1298a (patch) | |
| tree | f96b55a27088ae71d74dc83d7cc3731c5d5bf6dc /divvy.c | |
| parent | a550ea0a47374705a37f36b0f05ffe9e4c8161fb (diff) | |
| download | puzzles-5f5b284c0bddbe67de14b2d2bfb596bc7ba1298a.zip puzzles-5f5b284c0bddbe67de14b2d2bfb596bc7ba1298a.tar.gz puzzles-5f5b284c0bddbe67de14b2d2bfb596bc7ba1298a.tar.bz2 puzzles-5f5b284c0bddbe67de14b2d2bfb596bc7ba1298a.tar.xz | |
Use C99 bool within source modules.
This is the main bulk of this boolification work, but although it's
making the largest actual change, it should also be the least
disruptive to anyone interacting with this code base downstream of me,
because it doesn't modify any interface between modules: all the
inter-module APIs were updated one by one in the previous commits.
This just cleans up the code within each individual source file to use
bool in place of int where I think that makes things clearer.
Diffstat (limited to 'divvy.c')
| -rw-r--r-- | divvy.c | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -212,7 +212,7 @@ * (This only works _because_ we've ensured the omino is simply * connected.) */ -static int addremcommon(int w, int h, int x, int y, int *own, int val) +static bool addremcommon(int w, int h, int x, int y, int *own, int val) { int neighbours[8]; int dir, count; @@ -239,8 +239,8 @@ static int addremcommon(int w, int h, int x, int y, int *own, int val) for (dir = 0; dir < 8; dir++) { int next = (dir + 1) & 7; - int gotthis = (neighbours[dir] == val); - int gotnext = (neighbours[next] == val); + bool gotthis = (neighbours[dir] == val); + bool gotnext = (neighbours[next] == val); if (gotthis != gotnext) count++; @@ -262,7 +262,8 @@ static int addremcommon(int w, int h, int x, int y, int *own, int val) */ static int *divvy_internal(int w, int h, int k, random_state *rs) { - int *order, *queue, *tmp, *own, *sizes, *addable, *removable, *retdsf; + int *order, *queue, *tmp, *own, *sizes, *addable, *retdsf; + bool *removable; int wh = w*h; int i, j, n, x, y, qhead, qtail; @@ -275,7 +276,7 @@ static int *divvy_internal(int w, int h, int k, random_state *rs) sizes = snewn(n, int); queue = snewn(n, int); addable = snewn(wh*4, int); - removable = snewn(wh, int); + removable = snewn(wh, bool); /* * Permute the grid squares into a random order, which will be |