Make cppcheck happy.

This commit is contained in:
QC 2014-02-26 22:48:49 +01:00
parent c2e25dc0c1
commit a3569079c9
4 changed files with 11 additions and 11 deletions

View File

@ -45,7 +45,7 @@ static char **get_dmenu ( )
int index = 0; int index = 0;
while ( fgets( buffer, 1024, stdin ) != NULL ) { 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] = strdup( buffer );
retv[index+1] = NULL; retv[index+1] = NULL;

View File

@ -83,7 +83,7 @@ static pid_t exec_cmd( const char *cmd, int run_in_term )
if ( fd != NULL ) { if ( fd != NULL ) {
while ( fgets( buffer,1024,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'; buffer[strlen( buffer )-1] = '\0';
retv[index] = strdup( buffer ); retv[index] = strdup( buffer );
retv[index+1] = NULL; retv[index+1] = NULL;
@ -146,7 +146,7 @@ static void delete_entry( const char *cmd )
if ( fd != NULL ) { if ( fd != NULL ) {
while ( fgets( buffer,1024,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'; buffer[strlen( buffer )-1] = '\0';
retv[index] = strdup( buffer ); retv[index] = strdup( buffer );
retv[index+1] = NULL; retv[index+1] = NULL;
@ -213,7 +213,7 @@ static char ** get_apps ( )
if ( fd != NULL ) { if ( fd != NULL ) {
while ( fgets( buffer,1024,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'; buffer[strlen( buffer )-1] = '\0';
retv[index] = strdup( buffer ); retv[index] = strdup( buffer );
retv[index+1] = NULL; retv[index+1] = NULL;
@ -252,7 +252,7 @@ static char ** get_apps ( )
if ( found == 1 ) continue; 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] = strdup( dent->d_name );
retv[index+1] = NULL; retv[index+1] = NULL;
index++; index++;

View File

@ -368,7 +368,7 @@ int winlist_find( winlist *l, Window w )
// iterate backwards. theory is: windows most often accessed will be // iterate backwards. theory is: windows most often accessed will be
// nearer the end. testing with kcachegrind seems to support this... // nearer the end. testing with kcachegrind seems to support this...
int i; int i;
Window o; Window o = 0;
winlist_descend( l, i, o ) if ( w == o ) return i; winlist_descend( l, i, o ) if ( w == o ) return i;
@ -1203,7 +1203,7 @@ SwitcherMode run_switcher_window ( char **input )
int lines = 0; int lines = 0;
// build the actual list // build the actual list
Window w; Window w = 0;
winlist_ascend( ids, i, w ) { winlist_ascend( ids, i, w ) {
client *c; client *c;

View File

@ -80,7 +80,7 @@ static pid_t exec_ssh( const char *cmd )
if ( fd != NULL ) { if ( fd != NULL ) {
while ( fgets( buffer,1024,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'; buffer[strlen( buffer )-1] = '\0';
retv[index] = strdup( buffer ); retv[index] = strdup( buffer );
retv[index+1] = NULL; retv[index+1] = NULL;
@ -144,7 +144,7 @@ static void delete_ssh( const char *cmd )
if ( fd != NULL ) { if ( fd != NULL ) {
while ( fgets( buffer,1024,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'; buffer[strlen( buffer )-1] = '\0';
retv[index] = strdup( buffer ); retv[index] = strdup( buffer );
retv[index+1] = NULL; retv[index+1] = NULL;
@ -211,7 +211,7 @@ static char ** get_ssh ( )
if ( fd != NULL ) { if ( fd != NULL ) {
while ( fgets( buffer,1024,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'; buffer[strlen( buffer )-1] = '\0';
retv[index] = strdup( buffer ); retv[index] = strdup( buffer );
retv[index+1] = NULL; retv[index+1] = NULL;
@ -252,7 +252,7 @@ static char ** get_ssh ( )
if ( found == 1 ) continue; 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] = strndup( &buffer[start], stop-start );
retv[index+1] = NULL; retv[index+1] = NULL;
index++; index++;