aboutsummaryrefslogtreecommitdiff
path: root/unfinished/separate.c
diff options
context:
space:
mode:
authorBen Harris <bjh21@bjh21.me.uk>2023-02-16 21:21:15 +0000
committerBen Harris <bjh21@bjh21.me.uk>2023-02-18 00:13:15 +0000
commit0186d78da9e83103eb80b3814d4de8031f29232f (patch)
tree26774b7be7540d980a1ee5cba5d83445a528bd5b /unfinished/separate.c
parenta7e738aceb36e4a70d41cf09a74b2d7a3af6cbe0 (diff)
downloadpuzzles-0186d78da9e83103eb80b3814d4de8031f29232f.zip
puzzles-0186d78da9e83103eb80b3814d4de8031f29232f.tar.gz
puzzles-0186d78da9e83103eb80b3814d4de8031f29232f.tar.bz2
puzzles-0186d78da9e83103eb80b3814d4de8031f29232f.tar.xz
Mark many more function (and some objects) static
I noticed commit db3b531e2cab765a00475054d2e9046c9d0437d3 in the history where Simon added a bunch of "static" qualifiers. That suggested that consistently marking internal functions "static" is desirable, so I tried a build using GCC's -Wmissing-declarations, which requires prior declaration (presumed to be in a header file) of all global functions. This commit makes the GTK build clean under GCC's -Wmissing-declarations. I've also adding "static" to a few obviously internal objects, but GCC doesn't complain about those so I certainly haven't got them all.
Diffstat (limited to 'unfinished/separate.c')
-rw-r--r--unfinished/separate.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/unfinished/separate.c b/unfinished/separate.c
index 1a8edc6..9ffa632 100644
--- a/unfinished/separate.c
+++ b/unfinished/separate.c
@@ -215,7 +215,7 @@ struct solver_scratch {
int *tmp;
};
-struct solver_scratch *solver_scratch_new(int w, int h, int k)
+static struct solver_scratch *solver_scratch_new(int w, int h, int k)
{
int wh = w*h;
struct solver_scratch *sc = snew(struct solver_scratch);
@@ -233,7 +233,7 @@ struct solver_scratch *solver_scratch_new(int w, int h, int k)
return sc;
}
-void solver_scratch_free(struct solver_scratch *sc)
+static void solver_scratch_free(struct solver_scratch *sc)
{
sfree(sc->dsf);
sfree(sc->size);
@@ -243,7 +243,7 @@ void solver_scratch_free(struct solver_scratch *sc)
sfree(sc);
}
-void solver_connect(struct solver_scratch *sc, int yx1, int yx2)
+static void solver_connect(struct solver_scratch *sc, int yx1, int yx2)
{
int w = sc->w, h = sc->h, k = sc->k;
int wh = w*h;
@@ -297,7 +297,7 @@ void solver_connect(struct solver_scratch *sc, int yx1, int yx2)
sc->disconnect[i*wh+yx2]);
}
-void solver_disconnect(struct solver_scratch *sc, int yx1, int yx2)
+static void solver_disconnect(struct solver_scratch *sc, int yx1, int yx2)
{
int w = sc->w, h = sc->h;
int wh = w*h;
@@ -316,7 +316,7 @@ void solver_disconnect(struct solver_scratch *sc, int yx1, int yx2)
sc->disconnect[yx2*wh+yx1] = true;
}
-void solver_init(struct solver_scratch *sc)
+static void solver_init(struct solver_scratch *sc)
{
int w = sc->w, h = sc->h;
int wh = w*h;
@@ -332,8 +332,8 @@ void solver_init(struct solver_scratch *sc)
memset(sc->disconnect, 0, wh*wh * sizeof(bool));
}
-int solver_attempt(struct solver_scratch *sc, const unsigned char *grid,
- bool *gen_lock)
+static int solver_attempt(struct solver_scratch *sc, const unsigned char *grid,
+ bool *gen_lock)
{
int w = sc->w, h = sc->h, k = sc->k;
int wh = w*h;
@@ -492,7 +492,7 @@ int solver_attempt(struct solver_scratch *sc, const unsigned char *grid,
return 0;
}
-unsigned char *generate(int w, int h, int k, random_state *rs)
+static unsigned char *generate(int w, int h, int k, random_state *rs)
{
int wh = w*h;
int n = wh/k;