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]
This commit is contained in:
Simon Tatham
2005-06-01 17:47:56 +00:00
parent ad3abd9867
commit 50edaa578b
15 changed files with 237 additions and 174 deletions

View File

@ -173,7 +173,7 @@ static game_params *custom_params(config_item *cfg)
static char *validate_params(game_params *params)
{
if (params->w < 2 && params->h < 2)
if (params->w < 2 || params->h < 2)
return "Width and height must both be at least two";
return NULL;
@ -505,6 +505,7 @@ static game_state *dup_game(game_state *state)
static void free_game(game_state *state)
{
sfree(state->tiles);
sfree(state);
}