mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-21 08:01:30 -07:00
Fix some unused-variable warnings.
A test-build with a modern clang points out a number of 'set but not used' variables, which clang seems to have got better at recently. In cases where there's conditioned-out or commented-out code using the variable, I've left it in and added a warning-suppressing cast to void. Otherwise I've just deleted the variables.
This commit is contained in:
@ -1590,6 +1590,7 @@ static int lay_dominoes(game_state *state, random_state *rs, int *scratch)
|
|||||||
}
|
}
|
||||||
|
|
||||||
debug(("Laid %d dominoes, total %d dominoes.\n", nlaid, state->wh/2));
|
debug(("Laid %d dominoes, total %d dominoes.\n", nlaid, state->wh/2));
|
||||||
|
(void)nlaid;
|
||||||
game_debug(state, "Final layout");
|
game_debug(state, "Final layout");
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
6
mosaic.c
6
mosaic.c
@ -409,7 +409,7 @@ static void count_clues_around(const game_params *params,
|
|||||||
static void mark_around(const game_params *params,
|
static void mark_around(const game_params *params,
|
||||||
struct solution_cell *sol, int x, int y, int mark)
|
struct solution_cell *sol, int x, int y, int mark)
|
||||||
{
|
{
|
||||||
int i, j, marked = 0;
|
int i, j;
|
||||||
struct solution_cell *curr;
|
struct solution_cell *curr;
|
||||||
|
|
||||||
for (i = -1; i < 2; i++) {
|
for (i = -1; i < 2; i++) {
|
||||||
@ -418,7 +418,6 @@ static void mark_around(const game_params *params,
|
|||||||
if (curr) {
|
if (curr) {
|
||||||
if (curr->cell == STATE_UNMARKED) {
|
if (curr->cell == STATE_UNMARKED) {
|
||||||
curr->cell = mark;
|
curr->cell = mark;
|
||||||
marked++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -585,7 +584,7 @@ static bool solve_game_actual(const game_params *params,
|
|||||||
int board_size = params->height * params->width;
|
int board_size = params->height * params->width;
|
||||||
struct solution_cell *sol = snewn(board_size, struct solution_cell);
|
struct solution_cell *sol = snewn(board_size, struct solution_cell);
|
||||||
bool made_progress = true, error = false;
|
bool made_progress = true, error = false;
|
||||||
int solved = 0, iter = 0, curr = 0;
|
int solved = 0, curr = 0;
|
||||||
|
|
||||||
memset(sol, 0, params->height * params->width * sizeof(*sol));
|
memset(sol, 0, params->height * params->width * sizeof(*sol));
|
||||||
solved = 0;
|
solved = 0;
|
||||||
@ -607,7 +606,6 @@ static bool solve_game_actual(const game_params *params,
|
|||||||
solved += curr;
|
solved += curr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
iter++;
|
|
||||||
}
|
}
|
||||||
if (sol_return) {
|
if (sol_return) {
|
||||||
*sol_return = sol;
|
*sol_return = sol;
|
||||||
|
@ -634,8 +634,6 @@ static char *new_game_desc(const game_params *params, random_state *rs,
|
|||||||
DSF *dsf = NULL;
|
DSF *dsf = NULL;
|
||||||
int i, r, c;
|
int i, r, c;
|
||||||
|
|
||||||
int attempts = 0;
|
|
||||||
|
|
||||||
for (i = 0; i < wh; ++i) shuf[i] = i;
|
for (i = 0; i < wh; ++i) shuf[i] = i;
|
||||||
xshuffle(shuf, wh, rs);
|
xshuffle(shuf, wh, rs);
|
||||||
|
|
||||||
@ -646,7 +644,6 @@ static char *new_game_desc(const game_params *params, random_state *rs,
|
|||||||
soln[wh] = '\0';
|
soln[wh] = '\0';
|
||||||
|
|
||||||
do {
|
do {
|
||||||
++attempts;
|
|
||||||
setmem(soln, '@', wh);
|
setmem(soln, '@', wh);
|
||||||
|
|
||||||
dsf_free(dsf);
|
dsf_free(dsf);
|
||||||
|
@ -663,7 +663,7 @@ static bool solve_puzzle(const game_state *state, unsigned char *grid,
|
|||||||
#ifndef STANDALONE_PICTURE_GENERATOR
|
#ifndef STANDALONE_PICTURE_GENERATOR
|
||||||
static unsigned char *generate_soluble(random_state *rs, int w, int h)
|
static unsigned char *generate_soluble(random_state *rs, int w, int h)
|
||||||
{
|
{
|
||||||
int i, j, ntries, max;
|
int i, j, max;
|
||||||
bool ok;
|
bool ok;
|
||||||
unsigned char *grid, *matrix, *workspace;
|
unsigned char *grid, *matrix, *workspace;
|
||||||
unsigned int *changed_h, *changed_w;
|
unsigned int *changed_h, *changed_w;
|
||||||
@ -679,11 +679,7 @@ static unsigned char *generate_soluble(random_state *rs, int w, int h)
|
|||||||
changed_w = snewn(max+1, unsigned int);
|
changed_w = snewn(max+1, unsigned int);
|
||||||
rowdata = snewn(max+1, int);
|
rowdata = snewn(max+1, int);
|
||||||
|
|
||||||
ntries = 0;
|
|
||||||
|
|
||||||
do {
|
do {
|
||||||
ntries++;
|
|
||||||
|
|
||||||
generate(rs, w, h, grid);
|
generate(rs, w, h, grid);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -865,6 +865,8 @@ static void gen_grid(int w, int h, int nc, int *grid, random_state *rs)
|
|||||||
|
|
||||||
#if defined GENERATION_DIAGNOSTICS || defined COUNT_FAILURES
|
#if defined GENERATION_DIAGNOSTICS || defined COUNT_FAILURES
|
||||||
printf("%d failures\n", failures);
|
printf("%d failures\n", failures);
|
||||||
|
#else
|
||||||
|
(void)failures;
|
||||||
#endif
|
#endif
|
||||||
#ifdef GENERATION_DIAGNOSTICS
|
#ifdef GENERATION_DIAGNOSTICS
|
||||||
{
|
{
|
||||||
|
6
undead.c
6
undead.c
@ -976,7 +976,7 @@ static int path_cmp(const void *a, const void *b) {
|
|||||||
|
|
||||||
static char *new_game_desc(const game_params *params, random_state *rs,
|
static char *new_game_desc(const game_params *params, random_state *rs,
|
||||||
char **aux, bool interactive) {
|
char **aux, bool interactive) {
|
||||||
int i,count,c,w,h,r,p,g;
|
int count,c,w,h,r,p,g;
|
||||||
game_state *new;
|
game_state *new;
|
||||||
|
|
||||||
/* Variables for puzzle generation algorithm */
|
/* Variables for puzzle generation algorithm */
|
||||||
@ -997,7 +997,6 @@ static char *new_game_desc(const game_params *params, random_state *rs,
|
|||||||
char *e;
|
char *e;
|
||||||
char *desc;
|
char *desc;
|
||||||
|
|
||||||
i = 0;
|
|
||||||
while (true) {
|
while (true) {
|
||||||
new = new_state(params);
|
new = new_state(params);
|
||||||
abort = false;
|
abort = false;
|
||||||
@ -1257,7 +1256,6 @@ static char *new_game_desc(const game_params *params, random_state *rs,
|
|||||||
* difficulty level, free memory and start from scratch */
|
* difficulty level, free memory and start from scratch */
|
||||||
sfree(old_guess);
|
sfree(old_guess);
|
||||||
free_game(new);
|
free_game(new);
|
||||||
i++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We have a valid puzzle! */
|
/* We have a valid puzzle! */
|
||||||
@ -1578,6 +1576,8 @@ static char *solve_game(const game_state *state_start, const game_state *currsta
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* printf("Puzzle solved at level %s, iterations %d, ambiguous %d\n", (solved_bruteforce ? "TRICKY" : "NORMAL"), iterative_depth, count_ambiguous); */
|
/* printf("Puzzle solved at level %s, iterations %d, ambiguous %d\n", (solved_bruteforce ? "TRICKY" : "NORMAL"), iterative_depth, count_ambiguous); */
|
||||||
|
(void)iterative_depth;
|
||||||
|
(void)count_ambiguous;
|
||||||
|
|
||||||
move = snewn(solve_state->common->num_total * 4 +2, char);
|
move = snewn(solve_state->common->num_total * 4 +2, char);
|
||||||
c = move;
|
c = move;
|
||||||
|
2
unruly.c
2
unruly.c
@ -1398,6 +1398,8 @@ static char *new_game_desc(const game_params *params, random_state *rs,
|
|||||||
temp_verbose = solver_verbose;
|
temp_verbose = solver_verbose;
|
||||||
solver_verbose = false;
|
solver_verbose = false;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
(void)attempts;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
unruly_free_scratch(scratch);
|
unruly_free_scratch(scratch);
|
||||||
|
Reference in New Issue
Block a user