diff options
author | Daniel Carl <danielcarl@gmx.de> | 2014-06-09 15:31:53 +0200 |
---|---|---|
committer | Daniel Carl <danielcarl@gmx.de> | 2014-06-09 15:34:44 +0200 |
commit | dd0d010d232d0a8bdfa6e944c94ae4ada37a5a5c (patch) | |
tree | f8b0c38eac1aed3a00a1b5280a09adf12ffdd788 /src/util.c | |
parent | 8ea85ae8db6ecd494cc0530948ff9cad209c864c (diff) |
Don't write to history file for history size of 0.
Diffstat (limited to 'src/util.c')
-rw-r--r-- | src/util.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -122,11 +122,17 @@ GList *util_file_to_unique_list(const char *filename, Util_Content_Func func, /* yes, the whole file is read and wen possible don not need all the * lines, but this is easier to implement compared to reading the file * line wise from ent to begining */ - char *line, **lines = util_get_lines(filename); + char *line, **lines; void *value; int len, num_items = 0; - len = g_strv_length(lines); + /* return empty list if max items is 0 */ + if (!max_items) { + return gl; + } + + lines = util_get_lines(filename); + len = g_strv_length(lines); if (!len) { return gl; } |