summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ccc7104)
raw | patch | inline | side by side (parent: ccc7104)
author | Jonathan Neuschäfer <j.neuschaefer@gmx.net> | |
Tue, 27 Sep 2011 17:13:43 +0000 (19:13 +0200) | ||
committer | Jonathan Neuschäfer <j.neuschaefer@gmx.net> | |
Sun, 2 Oct 2011 18:54:04 +0000 (20:54 +0200) |
clang --analyze pointed me to this code:
src/filelist.c:146:3: warning: Value stored to 'iter' is never read
src/filelist.c:146:3: warning: Value stored to 'iter' is never read
src/filelist.c | patch | blob | history |
diff --git a/src/filelist.c b/src/filelist.c
index 73cc6f3111761d32ca0e7895daec37f3fba37c7d..91e569192b9bbda416356b32ed1b74ffe161d1a7 100644 (file)
--- a/src/filelist.c
+++ b/src/filelist.c
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;