From e3cef1b8a90a940f5cafcb76f7666bc7049586f5 Mon Sep 17 00:00:00 2001 From: QC Date: Wed, 7 Jan 2015 22:11:12 +0100 Subject: [PATCH] Coverity annoyance. --- source/rofi.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/source/rofi.c b/source/rofi.c index b3386477..53dfda74 100644 --- a/source/rofi.c +++ b/source/rofi.c @@ -780,11 +780,13 @@ static int dist ( const char *s, const char *t, int *d, int ls, int lt, int i, i } static int levenshtein ( const char *s, const char *t ) { - int ls = strlen ( s ), lt = strlen ( t ); - ssize_t array_length = ( ls + 1 ) * ( lt + 1 ); - int d[array_length]; + int ls = strlen ( s ), lt = strlen ( t ); + size_t array_length = ( ls + 1 ) * ( lt + 1 ); + // For some reason Coverity does not get that I initialize the + // array in for loop. + int d[array_length]; - for ( ssize_t i = 0; i < array_length; i++ ) { + for ( size_t i = 0; i < array_length; i++ ) { d[i] = -1; }