sl: osad -Wcalloc-transposed args

warning: 'calloc' sizes specified with 'sizeof' in the earlier argument
and not in the later argument [-Wcalloc-transposed-args].

Swap the args.
This commit is contained in:
Jeffrey Altman
2024-06-03 14:19:45 -04:00
parent 17402aef07
commit b74ab765c7

View File

@@ -434,9 +434,9 @@ osad(const char *s1, const char *s2)
size_t l1 = strlen(s1), l2 = strlen(s2), i, j;
int *row0, *row1, *row2, *tmp, cost;
row0 = calloc(sizeof(int), l2 + 1);
row1 = calloc(sizeof(int), l2 + 1);
row2 = calloc(sizeof(int), l2 + 1);
row0 = calloc(l2 + 1, sizeof(int));
row1 = calloc(l2 + 1, sizeof(int));
row2 = calloc(l2 + 1, sizeof(int));
for (j = 0; j < l2 + 1; j++)
row1[j] = j;
@@ -448,7 +448,7 @@ osad(const char *s1, const char *s2)
for (j = 0; j < l2; j++) {
row2[j + 1] = row1[j] + (s1[i] != s2[j]); /* substitute */
if (row2[j + 1] > row1[j + 1] + 1) /* delete */
row2[j + 1] = row1[j + 1] + 1;
if (row2[j + 1] > row2[j] + 1) /* insert */