1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2024-11-25 13:55:34 -05:00

Make analysis happy and prefer heap over stack.

This commit is contained in:
QC 2015-01-10 15:13:10 +01:00
parent 479123fcef
commit 7e6a24f9b6

View file

@ -781,15 +781,18 @@ static int levenshtein ( const char *s, const char *t )
{ {
int ls = strlen ( s ), lt = strlen ( t ); int ls = strlen ( s ), lt = strlen ( t );
size_t array_length = ( ls + 1 ) * ( lt + 1 ); size_t array_length = ( ls + 1 ) * ( lt + 1 );
// For some reason Coverity does not get that I initialize the // For some reason Coverity does not get that I initialize the
// array in for loop. // array in for loop.
int d[array_length]; int *d = g_malloc_n ( array_length, sizeof ( int ) );
for ( size_t i = 0; i < array_length; i++ ) { for ( size_t i = 0; i < array_length; i++ ) {
d[i] = -1; d[i] = -1;
} }
return dist ( s, t, d, ls, lt, 0, 0 ); int retv = dist ( s, t, d, ls, lt, 0, 0 );
g_free ( d );
return retv;
} }
static void window_set_opacity ( Display *display, Window box, unsigned int opacity ) static void window_set_opacity ( Display *display, Window box, unsigned int opacity )