Small code refactor to work around mis-detect static code analyzer.

This commit is contained in:
Dave Davenport 2017-05-03 17:41:14 +02:00
parent fb11b8ceb6
commit 1f76e2c3f3
1 changed files with 4 additions and 1 deletions

View File

@ -684,9 +684,12 @@ unsigned int levenshtein ( const char *needle, const glong needlelen, const char
return UINT_MAX;
}
unsigned int column[needlelen + 1];
for ( glong y = 0; y <= needlelen; y++ ) {
for ( glong y = 0; y < needlelen; y++ ) {
column[y] = y;
}
// Removed out of the loop, otherwise static code analyzers think it is unset.. silly but true.
// old loop: for ( glong y = 0; y <= needlelen; y++)
column[needlelen] = needlelen;
for ( glong x = 1; x <= haystacklen; x++ ) {
const char *needles = needle;
column[0] = x;