diff options
| author | Ben Harris <bjh21@bjh21.me.uk> | 2023-02-16 21:21:15 +0000 |
|---|---|---|
| committer | Ben Harris <bjh21@bjh21.me.uk> | 2023-02-18 00:13:15 +0000 |
| commit | 0186d78da9e83103eb80b3814d4de8031f29232f (patch) | |
| tree | 26774b7be7540d980a1ee5cba5d83445a528bd5b /matching.c | |
| parent | a7e738aceb36e4a70d41cf09a74b2d7a3af6cbe0 (diff) | |
| download | puzzles-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 'matching.c')
| -rw-r--r-- | matching.c | 26 |
1 files changed, 13 insertions, 13 deletions
@@ -368,13 +368,13 @@ static void matching_witness(void *scratchv, int nl, int nr, int *witness) #include "tree234.h" -int nl, nr, count; -int **adjlists, *adjsizes; -int *adjdata, *outl, *outr, *witness; -void *scratch; -random_state *rs; +static int nl, nr, count; +static int **adjlists, *adjsizes; +static int *adjdata, *outl, *outr, *witness; +static void *scratch; +static random_state *rs; -void allocate(int nl_, int nr_, int maxedges) +static void allocate(int nl_, int nr_, int maxedges) { nl = nl_; nr = nr_; @@ -387,7 +387,7 @@ void allocate(int nl_, int nr_, int maxedges) scratch = smalloc(matching_scratch_size(nl, nr)); } -void deallocate(void) +static void deallocate(void) { sfree(adjlists); sfree(adjsizes); @@ -398,7 +398,7 @@ void deallocate(void) sfree(scratch); } -void find_and_check_matching(void) +static void find_and_check_matching(void) { int i, j, k; @@ -454,14 +454,14 @@ struct nodename { int index; }; -int compare_nodes(void *av, void *bv) +static int compare_nodes(void *av, void *bv) { const struct nodename *a = (const struct nodename *)av; const struct nodename *b = (const struct nodename *)bv; return strcmp(a->name, b->name); } -int node_index(tree234 *n2i, tree234 *i2n, const char *name) +static int node_index(tree234 *n2i, tree234 *i2n, const char *name) { struct nodename *nn, *nn_prev; char *namedup = dupstr(name); @@ -485,7 +485,7 @@ struct edge { int L, R; }; -int compare_edges(void *av, void *bv) +static int compare_edges(void *av, void *bv) { const struct edge *a = (const struct edge *)av; const struct edge *b = (const struct edge *)bv; @@ -496,7 +496,7 @@ int compare_edges(void *av, void *bv) return 0; } -void matching_from_user_input(FILE *fp, const char *filename) +static void matching_from_user_input(FILE *fp, const char *filename) { tree234 *Ln2i, *Li2n, *Rn2i, *Ri2n, *edges; char *line = NULL; @@ -576,7 +576,7 @@ void matching_from_user_input(FILE *fp, const char *filename) deallocate(); } -void test_subsets(void) +static void test_subsets(void) { int b = 8; int n = 1 << b; |