aboutsummaryrefslogtreecommitdiff
path: root/pattern.c
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2021-12-11 13:56:12 +0000
committerSimon Tatham <anakin@pobox.com>2021-12-11 13:56:12 +0000
commitb56c994b721f7cb5c5bcf09c5d695d4ae07d3052 (patch)
tree330edece694feb35f5be415cc8f4ba57dea81942 /pattern.c
parentd399a6b23051335ce3107f11822ae352816fcd50 (diff)
downloadpuzzles-b56c994b721f7cb5c5bcf09c5d695d4ae07d3052.zip
puzzles-b56c994b721f7cb5c5bcf09c5d695d4ae07d3052.tar.gz
puzzles-b56c994b721f7cb5c5bcf09c5d695d4ae07d3052.tar.bz2
puzzles-b56c994b721f7cb5c5bcf09c5d695d4ae07d3052.tar.xz
Pattern: fix a compile warning about memset bounds.
The argument to memset was being taken from an int variable that not all compilers are able to prove is non-negative. Adding an assert convinces them.
Diffstat (limited to 'pattern.c')
-rw-r--r--pattern.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/pattern.c b/pattern.c
index 278bc33..7c00bf9 100644
--- a/pattern.c
+++ b/pattern.c
@@ -439,6 +439,8 @@ static bool do_row(unsigned char *known, unsigned char *deduced,
int rowlen, i, freespace;
bool done_any;
+ assert(len >= 0); /* avoid compile warnings about the memsets below */
+
freespace = len+1;
for (rowlen = 0; data[rowlen]; rowlen++) {
minpos_done[rowlen] = minpos_ok[rowlen] = len - 1;