summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQC <qball@gmpclient.org>2015-01-07 22:11:12 +0100
committerQC <qball@gmpclient.org>2015-01-07 22:11:12 +0100
commite3cef1b8a90a940f5cafcb76f7666bc7049586f5 (patch)
treefe08b66c92955f72aa47eb5beac7059150cd4bc7
parent1e8c94eaab5a1bfcb44e4893e32d8558c3ad05e5 (diff)
Coverity annoyance.
-rw-r--r--source/rofi.c10
1 files 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;
}