author Andre Noll Wed, 4 Sep 2013 19:26:46 +0000 (19:26 +0000) committer Andre Noll Sun, 13 Oct 2013 13:25:06 +0000 (15:25 +0200)
These two functions have only one caller, compute_dynamic_score(), which
just adds the two return values. Let's combine all three functions to a
single one.

 mood.c patch | blob | history

diff --git a/mood.c b/mood.c
index db5d8af..2cb7bc6 100644 (file)
--- a/mood.c
+++ b/mood.c
@@ -462,21 +462,12 @@ static int64_t normalized_value(int64_t x, int64_t n, int64_t sum, int64_t qd)
return 100 * (n * x - sum) / (int64_t)int_sqrt(n * qd);
}

-static long compute_num_played_score(struct afs_info *afsi)
-{
-       return -normalized_value(afsi->num_played, statistics.num,
-               statistics.num_played_sum, statistics.num_played_qd);
-}
-
-static long compute_last_played_score(struct afs_info *afsi)
-{
-       return -normalized_value(afsi->last_played, statistics.num,
-               statistics.last_played_sum, statistics.last_played_qd);
-}
-
static long compute_dynamic_score(struct afs_info *afsi)
{
-       return compute_num_played_score(afsi) + compute_last_played_score(afsi);
+       return -normalized_value(afsi->num_played, statistics.num,
+                       statistics.num_played_sum, statistics.num_played_qd)
+               - normalized_value(afsi->last_played, statistics.num,
+                       statistics.last_played_sum, statistics.last_played_qd);
}

static int add_afs_statistics(const struct osl_row *row)