mood.c: Rename compute_mood_score().
authorAndre Noll <maan@tuebingen.mpg.de>
Thu, 6 Jul 2017 18:46:29 +0000 (20:46 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Tue, 18 Jul 2017 14:13:46 +0000 (16:13 +0200)
The main purpose of this function is to determine whether the
audio file is admissible with respect to the given mood. So
row_is_admissible() is more to the point.

mood.c

diff --git a/mood.c b/mood.c
index 2b063cfd6b804373fb8f623b377781d949e53acf..208bdc45ea5adf7d9c4ca67e505902d694718306 100644 (file)
--- a/mood.c
+++ b/mood.c
@@ -142,8 +142,8 @@ static bool get_item_score(struct mood_item *item, const struct afs_info *afsi,
 }
 
 /* returns 1 if row admissible, 0 if not, negative on errors */
 }
 
 /* returns 1 if row admissible, 0 if not, negative on errors */
-static int compute_mood_score(const struct osl_row *aft_row, struct mood *m,
-               long *result)
+static int row_is_admissible(const struct osl_row *aft_row, struct mood *m,
+               long *scorep)
 {
        struct mood_item *item;
        int ret;
 {
        struct mood_item *item;
        int ret;
@@ -192,7 +192,7 @@ static int compute_mood_score(const struct osl_row *aft_row, struct mood *m,
        }
        if (score_arg_sum)
                score /= score_arg_sum;
        }
        if (score_arg_sum)
                score /= score_arg_sum;
-       *result = score;
+       *scorep = score;
        return 1;
 }
 
        return 1;
 }
 
@@ -571,7 +571,7 @@ static int add_if_admissible(struct osl_row *aft_row, void *data)
        int ret;
        long score = 0;
 
        int ret;
        long score = 0;
 
-       ret = compute_mood_score(aft_row, aa->m, &score);
+       ret = row_is_admissible(aft_row, aa->m, &score);
        if (ret <= 0)
                return ret;
        if (statistics.num >= aa->size) {
        if (ret <= 0)
                return ret;
        if (statistics.num >= aa->size) {
@@ -718,7 +718,7 @@ static int mood_update_audio_file(const struct osl_row *aft_row,
        if (ret < 0)
                return ret;
        was_admissible = ret;
        if (ret < 0)
                return ret;
        was_admissible = ret;
-       ret = compute_mood_score(aft_row, current_mood, &score);
+       ret = row_is_admissible(aft_row, current_mood, &score);
        if (ret < 0)
                return ret;
        is_admissible = (ret > 0);
        if (ret < 0)
                return ret;
        is_admissible = (ret > 0);