shithub: puzzles

Download patch

ref: 373dadacc06210197e3d68c55a6d611126915120
parent: a46f0c2ba9537d91944b3734f18a3fbfb822c9f8
author: Simon Tatham <[email protected]>
date: Fri Oct 21 03:52:14 EDT 2022

Build fix: take declarations out of for loops.

The NestedVM build is still unhappy with this C99ism, unfortunately.

--- a/midend.c
+++ b/midend.c
@@ -386,10 +386,11 @@
 static char *encode_params(midend *me, const game_params *params, bool full)
 {
     char *encoded = me->ourgame->encode_params(params, full);
+    int i;
 
     /* Assert that the params consist of printable ASCII containing
      * neither '#' nor ':'. */
-    for (int i = 0; encoded[i]; i++)
+    for (i = 0; encoded[i]; i++)
         assert(encoded[i] >= 32 && encoded[i] < 127 &&
 	       encoded[i] != '#' && encoded[i] != ':');
     return encoded;
@@ -399,7 +400,8 @@
 {
     /* Assert that s is entirely printable ASCII, and hence safe for
      * writing in a save file. */
-    for (int i = 0; s[i]; i++)
+    int i;
+    for (i = 0; s[i]; i++)
         assert(s[i] >= 32 && s[i] < 127);
 }