]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - mood.c
mood: Simplify compute_dynamic_score().
[paraslash.git] / mood.c
diff --git a/mood.c b/mood.c
index e5e8495369f1e7ffffe36bd463ec5aadf6163e39..e60ef2fd6fc97cac81d65e32431749dab3c935eb 100644 (file)
--- a/mood.c
+++ b/mood.c
@@ -455,19 +455,6 @@ void mood_check_callback(int fd, __a_unused const struct osl_object *query)
        free(pb.buf);
 }
 
-#if 0
-static unsigned int_log2(uint64_t x)
-{
-       unsigned res = 0;
-
-       while (x) {
-               x /= 2;
-               res++;
-       }
-       return res;
-}
-#endif
-
 static int64_t normalized_value(int64_t x, int64_t n, int64_t sum, int64_t qd)
 {
        if (!n || !qd)
@@ -490,16 +477,10 @@ static long compute_last_played_score(struct afs_info *afsi)
 static long compute_dynamic_score(const struct osl_row *aft_row)
 {
        struct afs_info afsi;
-       int64_t score, nscore = 0, lscore = 0;
-       int ret;
 
-       ret = get_afsi_of_row(aft_row, &afsi);
-       if (ret < 0)
+       if (get_afsi_of_row(aft_row, &afsi) < 0)
                return -100;
-       nscore = compute_num_played_score(&afsi);
-       lscore = compute_last_played_score(&afsi);
-       score = nscore + lscore;
-       return score;
+       return compute_num_played_score(&afsi) + compute_last_played_score(&afsi);
 }
 
 static int add_afs_statistics(const struct osl_row *row)