]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - mood.c
aft.c: Check for osl errors in com_add_callback().
[paraslash.git] / mood.c
diff --git a/mood.c b/mood.c
index 639818c5b9f5626d05ddbe7399e49c9b1427600f..d29c62c22b396ac685f140b9d936f041184ca5d3 100644 (file)
--- a/mood.c
+++ b/mood.c
@@ -437,21 +437,9 @@ out:
  */
 int mood_check_callback(struct afs_callback_arg *aca)
 {
-       int ret;
-       struct para_buffer pb = {
-               .max_size = shm_get_shmmax(),
-               .private_data = &(struct afs_max_size_handler_data) {
-                       .fd = aca->fd,
-                       .band = SBD_OUTPUT
-               },
-               .max_size_handler = afs_max_size_handler
-       };
-
-       para_printf(&pb, "checking moods...\n");
-       ret = osl(osl_rbtree_loop(moods_table, BLOBCOL_ID, &pb,
+       para_printf(&aca->pbout, "checking moods...\n");
+       return osl(osl_rbtree_loop(moods_table, BLOBCOL_ID, &aca->pbout,
                check_mood));
-       flush_and_free_pb(&pb);
-       return ret;
 }
 
 static int64_t normalized_value(int64_t x, int64_t n, int64_t sum, int64_t qd)
@@ -868,6 +856,9 @@ static int reload_current_mood(void)
        int ret;
        char *mood_name = NULL;
 
+       ret = clear_score_table();
+       if (ret < 0)
+               return ret;
        if (!current_mood)
                return 1;
        PARA_NOTICE_LOG("reloading %s\n", current_mood->name?
@@ -896,8 +887,6 @@ static int reload_current_mood(void)
 int moods_event_handler(enum afs_events event, __a_unused struct para_buffer *pb,
                void *data)
 {
-       int ret;
-
        if (!current_mood)
                return 0;
        switch (event) {
@@ -910,10 +899,6 @@ int moods_event_handler(enum afs_events event, __a_unused struct para_buffer *pb
        case BLOB_ADD:
                if (data == moods_table || data == playlists_table)
                        return 1; /* no reload necessary for these */
-               ret = clear_score_table();
-               if (ret < 0)
-                       PARA_CRIT_LOG("clear score table returned %s\n",
-                               para_strerror(-ret));
                return reload_current_mood();
        /* these also require reload of the score table */
        case ATTRIBUTE_ADD: