From b74ab765c7b066e1b16a025d3e856dea9a570dbc Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Mon, 3 Jun 2024 14:19:45 -0400 Subject: [PATCH] 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. --- lib/sl/sl.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/sl/sl.c b/lib/sl/sl.c index c67cc525f..dc840cedb 100644 --- a/lib/sl/sl.c +++ b/lib/sl/sl.c @@ -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 */