]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - mood.c
afs.c: Improve activate_mood_or_playlist().
[paraslash.git] / mood.c
diff --git a/mood.c b/mood.c
index a58284a75d30f2b0aa008ae69d930b0e90d91edb..a2c3d099d1b5f25595e76ae843b1cf18d6a15f4f 100644 (file)
--- a/mood.c
+++ b/mood.c
@@ -405,11 +405,7 @@ _static_inline_ int64_t update_quadratic_deviation(int64_t n, int64_t old_qd,
 static int update_afs_statistics(struct afs_info *old_afsi,
                struct afs_info *new_afsi)
 {
-       unsigned n;
-       int ret = get_num_admissible_files(&n);
-
-       if (ret < 0)
-               return ret;
+       unsigned n = statistics.num;
        assert(n);
 
        statistics.last_played_qd = update_quadratic_deviation(n,
@@ -480,7 +476,8 @@ static int mood_update_audio_file(const struct osl_row *aft_row,
                struct afs_info *old_afsi)
 {
        long score, percent;
-       int ret, is_admissible, was_admissible = 0;
+       int ret;
+       bool is_admissible, was_admissible;
        struct afs_info afsi;
        unsigned rank;
 
@@ -672,19 +669,16 @@ out:
  * This function is called on events which render the current list of
  * admissible files useless, for example if an attribute is removed from the
  * attribute table.
- *
- * If no mood is currently open, the function returns success.
  */
 static int reload_current_mood(void)
 {
        int ret;
        char *mood_name = NULL;
 
+       assert(current_mood);
        ret = clear_score_table();
        if (ret < 0)
                return ret;
-       if (!current_mood)
-               return 1;
        PARA_NOTICE_LOG("reloading %s\n", current_mood->name?
                current_mood->name : "(dummy)");
        if (current_mood->name)