Allow for trailing '\0' in game_text_format() in various games.
authorjacob <jacob@cda61777-01e9-0310-a592-d414129be87e>
Wed, 4 May 2005 12:56:04 +0000 (12:56 +0000)
committerjacob <jacob@cda61777-01e9-0310-a592-d414129be87e>
Wed, 4 May 2005 12:56:04 +0000 (12:56 +0000)
git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5743 cda61777-01e9-0310-a592-d414129be87e

fifteen.c
rect.c
sixteen.c
twiddle.c

index c29e9fe..0ed5067 100644 (file)
--- 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 (file)
--- 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++) {
index cd6ae3b..950f724 100644 (file)
--- 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++) {
index 5209606..b03ca01 100644 (file)
--- 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++) {