summaryrefslogtreecommitdiff
path: root/src/util.c
diff options
context:
space:
mode:
authorDaniel Carl <danielcarl@gmx.de>2014-06-09 15:31:53 +0200
committerDaniel Carl <danielcarl@gmx.de>2014-06-09 15:34:44 +0200
commitdd0d010d232d0a8bdfa6e944c94ae4ada37a5a5c (patch)
treef8b0c38eac1aed3a00a1b5280a09adf12ffdd788 /src/util.c
parent8ea85ae8db6ecd494cc0530948ff9cad209c864c (diff)
Don't write to history file for history size of 0.
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/util.c b/src/util.c
index dba1c75..8f54144 100644
--- a/src/util.c
+++ b/src/util.c
@@ -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;
}