aboutsummaryrefslogtreecommitdiff
path: root/dsf.c
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2018-11-13 21:39:45 +0000
committerSimon Tatham <anakin@pobox.com>2018-11-13 21:48:24 +0000
commit20b56788bc61de5b3d10c90a9fd588d373134aae (patch)
treeea4d00104a346972a1a23120c125e95912551d06 /dsf.c
parentf6965b92e1915c9f49fafbadf603b4fd0da735bd (diff)
downloadpuzzles-20b56788bc61de5b3d10c90a9fd588d373134aae.zip
puzzles-20b56788bc61de5b3d10c90a9fd588d373134aae.tar.gz
puzzles-20b56788bc61de5b3d10c90a9fd588d373134aae.tar.bz2
puzzles-20b56788bc61de5b3d10c90a9fd588d373134aae.tar.xz
Adopt C99 bool in the edsf API.
Now the flag passed to edsf_merge to say whether two items are the same or opposite is a bool, and so is the flag returned via a pointer argument from edsf_canonify. The latter requires client code to be updated to match (otherwise you'll get a pointer type error), so I've done that update in Loopy, which is edsf's only current in-tree client.
Diffstat (limited to 'dsf.c')
-rw-r--r--dsf.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/dsf.c b/dsf.c
index aa22392..4f3abf0 100644
--- a/dsf.c
+++ b/dsf.c
@@ -15,7 +15,8 @@
int *equal_elements = snewn(size, int);
int *inverse_elements = snewn(size, int);
int printed_count = 0, equal_count, inverse_count;
- int i, n, inverse;
+ int i, n;
+ bool inverse;
memset(printed_elements, -1, sizeof(int) * size);
@@ -99,10 +100,10 @@ int dsf_size(int *dsf, int index) {
return dsf[dsf_canonify(dsf, index)] >> 2;
}
-int edsf_canonify(int *dsf, int index, int *inverse_return)
+int edsf_canonify(int *dsf, int index, bool *inverse_return)
{
int start_index = index, canonical_index;
- int inverse = 0;
+ bool inverse = false;
/* fprintf(stderr, "dsf = %p\n", dsf); */
/* fprintf(stderr, "Canonify %2d\n", index); */
@@ -141,9 +142,9 @@ int edsf_canonify(int *dsf, int index, int *inverse_return)
return index;
}
-void edsf_merge(int *dsf, int v1, int v2, int inverse)
+void edsf_merge(int *dsf, int v1, int v2, bool inverse)
{
- int i1, i2;
+ bool i1, i2;
/* fprintf(stderr, "dsf = %p\n", dsf); */
/* fprintf(stderr, "Merge [%2d,%2d], %d\n", v1, v2, inverse); */