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.
This commit is contained in:
Simon Tatham
2021-12-11 13:56:12 +00:00
parent d399a6b230
commit b56c994b72

View File

@ -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;