X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=mood.c;h=d29c62c22b396ac685f140b9d936f041184ca5d3;hp=fb988b2fa22e02c75dffa73a209fe393c115b0a9;hb=402bda88d8556619738ebde95cbcacac2e9f1169;hpb=77d4075da37f4ef364032ebe7a0cee378add80b1 diff --git a/mood.c b/mood.c index fb988b2f..d29c62c2 100644 --- a/mood.c +++ b/mood.c @@ -430,29 +430,16 @@ out: /** * Check all moods for syntax errors. * - * \param fd The afs socket. - * \param query Unused. + * \param aca Only ->pbout is used for diagnostics. * * \return Negative on fatal errors. Inconsistent mood definitions are not * considered an error. */ -int mood_check_callback(int fd, __a_unused const struct osl_object *query) +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 = 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) @@ -869,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? @@ -897,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) { @@ -911,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: