From 50edaa578b614eb74c57a38faa2d05ab628ff81b Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Wed, 1 Jun 2005 17:47:56 +0000 Subject: Miscellaneous fixes from James Harvey's PalmOS porting work: - fixed numerous memory leaks (not Palm-specific) - corrected a couple of 32-bit-int assumptions (vital for Palm but generally a good thing anyway) - lifted a few function pointer types into explicit typedefs (neutral for me but convenient for the source-munging Perl scripts he uses to deal with Palm code segment rules) - lifted a few function-level static arrays into global static arrays (neutral for me but apparently works round a Palm tools bug) - a couple more presets in Rectangles (so that Palm, or any other slow platform which can't handle the larger sizes easily, can still have some variety available) - in Solo, arranged a means of sharing scratch space between calls to nsolve to prevent a lot of redundant malloc/frees (gives a 10% speed increase even on existing platforms) [originally from svn r5897] --- twiddle.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'twiddle.c') diff --git a/twiddle.c b/twiddle.c index e66bdb0..7beedc4 100644 --- a/twiddle.c +++ b/twiddle.c @@ -409,7 +409,7 @@ static char *new_game_desc(game_params *params, random_state *rs, int k; k = sprintf(buf, "%d%c", grid[i] / 4, - params->orientable ? "uldr"[grid[i] & 3] : ','); + (char)(params->orientable ? "uldr"[grid[i] & 3] : ',')); ret = sresize(ret, retlen + k + 1, char); strcpy(ret + retlen, buf); @@ -764,6 +764,7 @@ static game_drawstate *game_new_drawstate(game_state *state) static void game_free_drawstate(game_drawstate *ds) { + sfree(ds->grid); sfree(ds); } -- cgit v1.1