diff options
author | Qball Cow <qball@gmpclient.org> | 2014-05-27 08:42:21 +0200 |
---|---|---|
committer | Qball Cow <qball@gmpclient.org> | 2014-05-27 08:42:21 +0200 |
commit | 3188236121cebe2300b20214a976c27b2dcba768 (patch) | |
tree | 75829d8ae7f7a25074ea3fad64f46457f1d5cd0b /source/history.c | |
parent | 749d3e62232ecd34694c6c3d8fadc1067c929f17 (diff) |
Cleanups
Diffstat (limited to 'source/history.c')
-rw-r--r-- | source/history.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/source/history.c b/source/history.c index 6c0f209b..4fabc5d9 100644 --- a/source/history.c +++ b/source/history.c @@ -248,10 +248,7 @@ void history_remove ( const char *filename, const char *entry ) // Free the list. for ( unsigned int iter = 0; iter < length; iter++ ) { - if ( list[iter] != NULL ) - { - free ( list[iter] ); - } + free ( list[iter] ); } if ( list != NULL ) { @@ -269,6 +266,8 @@ char ** history_get_list ( const char *filename, unsigned int *length ) FILE *fd = fopen ( filename, "r" ); if ( fd == NULL ) { + // File that does not exists is not an error, so ignore it. + // Everything else? panic. if ( errno != ENOENT ) { fprintf ( stderr, "Failed to open file: %s\n", strerror ( errno ) ); @@ -279,6 +278,7 @@ char ** history_get_list ( const char *filename, unsigned int *length ) list = __history_get_element_list ( fd, length ); // Copy list in right format. + // Lists are always short, so performance should not be an issue. if ( ( *length ) > 0 ) { retv = malloc ( ( ( *length ) + 1 ) * sizeof ( char * ) ); |