]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
mood: Add score value only for admissible files.
authorAndre Noll <maan@systemlinux.org>
Tue, 15 May 2012 21:19:29 +0000 (23:19 +0200)
committerAndre Noll <maan@systemlinux.org>
Wed, 13 Jun 2012 11:26:00 +0000 (13:26 +0200)
mood.c:175:3: warning: Value stored to 'ret' is never read
                ret = get_item_score(item, &afsi, &afhi, path, &item_score,
                ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This time scan-build found a real bug.

mood.c

diff --git a/mood.c b/mood.c
index f580400dd52bfe4d129f7526034745929b0cdf7e..d12bc20d77554c58a77b5b2da3b4a608e5309f34 100644 (file)
--- a/mood.c
+++ b/mood.c
@@ -173,6 +173,8 @@ static int compute_mood_score(const struct osl_row *aft_row, struct mood *m,
        list_for_each_entry(item, &m->score_list, mood_item_node) {
                ret = get_item_score(item, &afsi, &afhi, path, &item_score,
                        &score_arg_sum);
+               if (ret == 0)
+                       continue;
                score += item_score;
        }
        if (score_arg_sum)