mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-20 23:51:29 -07:00
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.
This commit is contained in:
@ -987,11 +987,11 @@ static void free_sets(struct sets *s)
|
||||
/*
|
||||
* Print a text formula for producing a given output.
|
||||
*/
|
||||
void print_recurse(struct sets *s, struct set *ss, int pathindex, int index,
|
||||
int priority, int assoc, int child);
|
||||
void print_recurse_inner(struct sets *s, struct set *ss,
|
||||
struct ancestor *a, int pathindex, int index,
|
||||
int priority, int assoc, int child)
|
||||
static void print_recurse(struct sets *s, struct set *ss, int pathindex,
|
||||
int index, int priority, int assoc, int child);
|
||||
static void print_recurse_inner(struct sets *s, struct set *ss,
|
||||
struct ancestor *a, int pathindex, int index,
|
||||
int priority, int assoc, int child)
|
||||
{
|
||||
if (a->prev && index != a->pr) {
|
||||
int pi;
|
||||
@ -1066,8 +1066,8 @@ void print_recurse_inner(struct sets *s, struct set *ss,
|
||||
printf("/%d", ss->numbers[2*index+1]);
|
||||
}
|
||||
}
|
||||
void print_recurse(struct sets *s, struct set *ss, int pathindex, int index,
|
||||
int priority, int assoc, int child)
|
||||
static void print_recurse(struct sets *s, struct set *ss, int pathindex,
|
||||
int index, int priority, int assoc, int child)
|
||||
{
|
||||
if (!ss->a.prev || pathindex < ss->a.prev->npaths) {
|
||||
print_recurse_inner(s, ss, &ss->a, pathindex,
|
||||
@ -1085,7 +1085,7 @@ void print_recurse(struct sets *s, struct set *ss, int pathindex, int index,
|
||||
}
|
||||
}
|
||||
}
|
||||
void print(int pathindex, struct sets *s, struct output *o)
|
||||
static void print(int pathindex, struct sets *s, struct output *o)
|
||||
{
|
||||
print_recurse(s, o->set, pathindex, o->index, 0, 0, 0);
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -957,7 +957,7 @@ struct game_drawstate {
|
||||
* subfunction. move_type() returns -1 for an illegal move, 0 for a
|
||||
* movement, and 1 for a push.
|
||||
*/
|
||||
int move_type(const game_state *state, int dx, int dy)
|
||||
static int move_type(const game_state *state, int dx, int dy)
|
||||
{
|
||||
int w = state->p.w, h = state->p.h;
|
||||
int px = state->px, py = state->py;
|
||||
|
Reference in New Issue
Block a user