From a3569079c9cda942855aa097bd8b1289500042c4 Mon Sep 17 00:00:00 2001 From: QC Date: Wed, 26 Feb 2014 22:48:49 +0100 Subject: [PATCH] Make cppcheck happy. --- source/dmenu-dialog.c | 2 +- source/run-dialog.c | 8 ++++---- source/simpleswitcher.c | 4 ++-- source/ssh-dialog.c | 8 ++++---- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/source/dmenu-dialog.c b/source/dmenu-dialog.c index 401f8c27..e5216994 100644 --- a/source/dmenu-dialog.c +++ b/source/dmenu-dialog.c @@ -45,7 +45,7 @@ static char **get_dmenu ( ) int index = 0; while ( fgets( buffer, 1024, stdin ) != NULL ) { - retv = realloc( retv, ( index+2 )*sizeof( char* ) ); + retv = reallocate( retv, ( index+2 )*sizeof( char* ) ); retv[index] = strdup( buffer ); retv[index+1] = NULL; diff --git a/source/run-dialog.c b/source/run-dialog.c index db8667f3..9d75929f 100644 --- a/source/run-dialog.c +++ b/source/run-dialog.c @@ -83,7 +83,7 @@ static pid_t exec_cmd( const char *cmd, int run_in_term ) if ( fd != NULL ) { while ( fgets( buffer,1024,fd ) != NULL ) { - retv = realloc( retv, ( index+2 )*sizeof( char* ) ); + retv = reallocate( retv, ( index+2 )*sizeof( char* ) ); buffer[strlen( buffer )-1] = '\0'; retv[index] = strdup( buffer ); retv[index+1] = NULL; @@ -146,7 +146,7 @@ static void delete_entry( const char *cmd ) if ( fd != NULL ) { while ( fgets( buffer,1024,fd ) != NULL ) { - retv = realloc( retv, ( index+2 )*sizeof( char* ) ); + retv = reallocate( retv, ( index+2 )*sizeof( char* ) ); buffer[strlen( buffer )-1] = '\0'; retv[index] = strdup( buffer ); retv[index+1] = NULL; @@ -213,7 +213,7 @@ static char ** get_apps ( ) if ( fd != NULL ) { while ( fgets( buffer,1024,fd ) != NULL ) { - retv = realloc( retv, ( index+2 )*sizeof( char* ) ); + retv = reallocate( retv, ( index+2 )*sizeof( char* ) ); buffer[strlen( buffer )-1] = '\0'; retv[index] = strdup( buffer ); retv[index+1] = NULL; @@ -252,7 +252,7 @@ static char ** get_apps ( ) if ( found == 1 ) continue; - retv = realloc( retv, ( index+2 )*sizeof( char* ) ); + retv = reallocate( retv, ( index+2 )*sizeof( char* ) ); retv[index] = strdup( dent->d_name ); retv[index+1] = NULL; index++; diff --git a/source/simpleswitcher.c b/source/simpleswitcher.c index c86973a2..84a80775 100644 --- a/source/simpleswitcher.c +++ b/source/simpleswitcher.c @@ -368,7 +368,7 @@ int winlist_find( winlist *l, Window w ) // iterate backwards. theory is: windows most often accessed will be // nearer the end. testing with kcachegrind seems to support this... int i; - Window o; + Window o = 0; winlist_descend( l, i, o ) if ( w == o ) return i; @@ -1203,7 +1203,7 @@ SwitcherMode run_switcher_window ( char **input ) int lines = 0; // build the actual list - Window w; + Window w = 0; winlist_ascend( ids, i, w ) { client *c; diff --git a/source/ssh-dialog.c b/source/ssh-dialog.c index b19b3bdb..59effa05 100644 --- a/source/ssh-dialog.c +++ b/source/ssh-dialog.c @@ -80,7 +80,7 @@ static pid_t exec_ssh( const char *cmd ) if ( fd != NULL ) { while ( fgets( buffer,1024,fd ) != NULL ) { - retv = realloc( retv, ( index+2 )*sizeof( char* ) ); + retv = reallocate( retv, ( index+2 )*sizeof( char* ) ); buffer[strlen( buffer )-1] = '\0'; retv[index] = strdup( buffer ); retv[index+1] = NULL; @@ -144,7 +144,7 @@ static void delete_ssh( const char *cmd ) if ( fd != NULL ) { while ( fgets( buffer,1024,fd ) != NULL ) { - retv = realloc( retv, ( index+2 )*sizeof( char* ) ); + retv = reallocate( retv, ( index+2 )*sizeof( char* ) ); buffer[strlen( buffer )-1] = '\0'; retv[index] = strdup( buffer ); retv[index+1] = NULL; @@ -211,7 +211,7 @@ static char ** get_ssh ( ) if ( fd != NULL ) { while ( fgets( buffer,1024,fd ) != NULL ) { - retv = realloc( retv, ( index+2 )*sizeof( char* ) ); + retv = reallocate( retv, ( index+2 )*sizeof( char* ) ); buffer[strlen( buffer )-1] = '\0'; retv[index] = strdup( buffer ); retv[index+1] = NULL; @@ -252,7 +252,7 @@ static char ** get_ssh ( ) if ( found == 1 ) continue; - retv = realloc( retv, ( index+2 )*sizeof( char* ) ); + retv = reallocate( retv, ( index+2 )*sizeof( char* ) ); retv[index] = strndup( &buffer[start], stop-start ); retv[index+1] = NULL; index++;