diff options
| author | Simon Tatham <anakin@pobox.com> | 2005-07-16 20:06:37 +0000 |
|---|---|---|
| committer | Simon Tatham <anakin@pobox.com> | 2005-07-16 20:06:37 +0000 |
| commit | 931a7ca45f4c247e974509922b879cc631a84ec9 (patch) | |
| tree | c7f3e087f599e34ad1eb62de79dcf14797c575a1 | |
| parent | e7d6c0aa330f4801d66bef6e048307982ee60614 (diff) | |
| download | puzzles-931a7ca45f4c247e974509922b879cc631a84ec9.zip puzzles-931a7ca45f4c247e974509922b879cc631a84ec9.tar.gz puzzles-931a7ca45f4c247e974509922b879cc631a84ec9.tar.bz2 puzzles-931a7ca45f4c247e974509922b879cc631a84ec9.tar.xz | |
Cleanups and memory leak fixes from James H.
[originally from svn r6099]
| -rw-r--r-- | dominosa.c | 5 | ||||
| -rw-r--r-- | misc.c | 1 |
2 files changed, 4 insertions, 2 deletions
@@ -1093,6 +1093,7 @@ static game_state *dup_game(game_state *state) static void free_game(game_state *state) { sfree(state->grid); + sfree(state->edges); if (--state->numbers->refcount <= 0) { sfree(state->numbers->numbers); sfree(state->numbers); @@ -1154,7 +1155,7 @@ static char *solve_game(game_state *state, game_state *currstate, int p2 = (i & 1) ? p1+1 : p1+w; extra = sprintf(buf, ";%c%d,%d", - v==-1 ? 'E' : 'D', p1, p2); + (int)(v==-1 ? 'E' : 'D'), p1, p2); if (retlen + extra + 1 >= retsize) { retsize = retlen + extra + 256; @@ -1257,7 +1258,7 @@ static char *interpret_move(game_state *state, game_ui *ui, game_drawstate *ds, (state->grid[d1] != d1 || state->grid[d2] != d2)) return NULL; - sprintf(buf, "%c%d,%d", button == RIGHT_BUTTON ? 'E' : 'D', d1, d2); + sprintf(buf, "%c%d,%d", (int)(button == RIGHT_BUTTON ? 'E' : 'D'), d1, d2); return dupstr(buf); } @@ -210,6 +210,7 @@ void shuffle(void *array, int nelts, int eltsize, random_state *rs) memcpy(carray + eltsize * j, tmp, eltsize); } } + sfree(tmp); } /* vim: set shiftwidth=4 tabstop=8: */ |