Revert a change in an assertion made in r6299. It was right the
authorsimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Thu, 5 Jan 2006 09:40:51 +0000 (09:40 +0000)
committersimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Thu, 5 Jan 2006 09:40:51 +0000 (09:40 +0000)
first time, and now has a comment explaining why!

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6511 cda61777-01e9-0310-a592-d414129be87e

loopy.c

diff --git a/loopy.c b/loopy.c
index 9f54c8a..f70e5b1 100644 (file)
--- a/loopy.c
+++ b/loopy.c
@@ -1210,8 +1210,14 @@ static char *encode_solve_move(const game_state *state)
         }
     }
 
-    /* No point in doing sums like that if they're going to be wrong */
-    assert(strlen(ret) == (size_t)len);
+    /*
+     * Ensure we haven't overrun the buffer we allocated (which we
+     * really shouldn't have, since we computed its maximum size).
+     * Note that this assert is <= rather than ==, because the
+     * solver is permitted to produce an incomplete solution in
+     * which case the buffer will be only partially used.
+     */
+    assert(strlen(ret) <= (size_t)len);
     return ret;
 }