From 96c199a560067fa870eee3fd1c5ef98e5edfb36e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jonathan=20Neusch=C3=A4fer?= Date: Tue, 27 Sep 2011 19:13:43 +0200 Subject: [PATCH] filelist: simplify some code clang --analyze pointed me to this code: src/filelist.c:146:3: warning: Value stored to 'iter' is never read --- src/filelist.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/filelist.c b/src/filelist.c index 73cc6f3..91e5691 100644 --- a/src/filelist.c +++ b/src/filelist.c @@ -139,15 +139,11 @@ filelist_sort_dir_play(struct filelist *filelist, GCompareFunc compare_func) if (filelist->entries->len < 2) return; + + /* If the first entry is NULL, skip it, because NULL stands for "[..]" */ iter = ((struct filelist_entry*) g_ptr_array_index(filelist->entries, 0))->entity; - /* This can only happen at the beginning of the filelist, - * because NULL stands for "[..]" */ - if (iter == NULL) { - iter = ((struct filelist_entry*) g_ptr_array_index(filelist->entries, 1))->entity; - first = 1; - } - else - first = 0; + first = (iter == NULL)? 1 : 0; + /* find the last directory entry */ for (last = first+1; last < filelist->entries->len; last++) { iter = ((struct filelist_entry*) g_ptr_array_index(filelist->entries, last))->entity; -- 2.30.2