shithub: puzzles

Download patch

ref: 262118324645da482747ef6c319fc428a40eb716
parent: 38c1f9b7028c4405e1e8145bc6639e33ffce147b
author: Jacob Nevins <jacobn@chiark.greenend.org.uk>
date: Wed May 4 08:56:04 EDT 2005

Allow for trailing '\0' in game_text_format() in various games.

[originally from svn r5743]

--- a/fifteen.c
+++ b/fifteen.c
@@ -421,7 +421,7 @@
      */
     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++) {
--- a/rect.c
+++ b/rect.c
@@ -1081,7 +1081,7 @@
      */
     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++) {
--- a/sixteen.c
+++ b/sixteen.c
@@ -429,7 +429,7 @@
      */
     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++) {
--- a/twiddle.c
+++ b/twiddle.c
@@ -521,7 +521,7 @@
      */
     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++) {