mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-20 23:51:29 -07:00
Style cleanups from the previous fixes.
Reordered the statements in the fixed Unruly blank_state so that there doesn't need to be a double if statement (and I think it's more sensible in any case to put each memset of a freshly allocated array immediately after the alloc). In GTK set_window_background, the nest of #ifdefs is now complicated enough to deserve a few comments on the #else and #endif lines. And while I was there I switched the gboolean to a bool, on my general principle that platform-specific boolean types are only worth using when you're passing them to a platform API function (and perhaps not even then, if it's not passed by reference).
This commit is contained in:
7
unruly.c
7
unruly.c
@ -360,15 +360,14 @@ static game_state *blank_state(int w2, int h2, bool unique, bool new_common)
|
||||
state->h2 = h2;
|
||||
state->unique = unique;
|
||||
state->grid = snewn(s, char);
|
||||
memset(state->grid, EMPTY, s);
|
||||
|
||||
if (new_common) {
|
||||
state->common = snew(unruly_common);
|
||||
state->common->refcount = 1;
|
||||
state->common->immutable = snewn(s, bool);
|
||||
}
|
||||
|
||||
memset(state->grid, EMPTY, s);
|
||||
if (new_common)
|
||||
memset(state->common->immutable, 0, s*sizeof(bool));
|
||||
}
|
||||
|
||||
state->completed = state->cheated = false;
|
||||
|
||||
|
Reference in New Issue
Block a user