From: jacob Date: Wed, 4 May 2005 12:56:04 +0000 (+0000) Subject: Allow for trailing '\0' in game_text_format() in various games. X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/puzzles/commitdiff_plain/48a10826fef7777bb8b061f4a121f481ced98bc0 Allow for trailing '\0' in game_text_format() in various games. git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5743 cda61777-01e9-0310-a592-d414129be87e --- diff --git a/fifteen.c b/fifteen.c index c29e9fe..0ed5067 100644 --- a/fifteen.c +++ b/fifteen.c @@ -421,7 +421,7 @@ static char *game_text_format(game_state *state) */ maxlen = state->h * state->w * (col+1); - ret = snewn(maxlen, char); + ret = snewn(maxlen+1, char); p = ret; for (y = 0; y < state->h; y++) { diff --git a/rect.c b/rect.c index abfd332..ffb3725 100644 --- a/rect.c +++ b/rect.c @@ -1081,7 +1081,7 @@ static char *game_text_format(game_state *state) */ maxlen = (2*state->h+1) * (state->w * (col+1) + 2); - ret = snewn(maxlen, char); + ret = snewn(maxlen+1, char); p = ret; for (y = 0; y <= 2*state->h; y++) { diff --git a/sixteen.c b/sixteen.c index cd6ae3b..950f724 100644 --- a/sixteen.c +++ b/sixteen.c @@ -429,7 +429,7 @@ static char *game_text_format(game_state *state) */ maxlen = state->h * state->w * (col+1); - ret = snewn(maxlen, char); + ret = snewn(maxlen+1, char); p = ret; for (y = 0; y < state->h; y++) { diff --git a/twiddle.c b/twiddle.c index 5209606..b03ca01 100644 --- a/twiddle.c +++ b/twiddle.c @@ -521,7 +521,7 @@ static char *game_text_format(game_state *state) */ maxlen = state->h * state->w * (col+o+1); - ret = snewn(maxlen, char); + ret = snewn(maxlen+1, char); p = ret; for (y = 0; y < state->h; y++) {