X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=mood.c;h=93461ee845c558ec30c0da78bf548939f1247857;hp=732df0a32f8d1e7d19d08f04c773dc5026589caf;hb=ec0c9721b6dfcbd70d7a1b318fb9b94e2aab9a5d;hpb=92f089b820b45a5dbdc5b4f69d596105d5acba68 diff --git a/mood.c b/mood.c index 732df0a3..93461ee8 100644 --- a/mood.c +++ b/mood.c @@ -79,13 +79,13 @@ struct mood { static struct mood *current_mood; /** - * Rough approximation to sqrt. + * Rough approximation to sqrt. * - * \param x Integer of which to calculate the sqrt. + * \param x Integer of which to calculate the sqrt. * - * \return An integer res with res * res <= x. + * \return An integer res with res * res <= x. */ -static uint64_t int_sqrt(uint64_t x) +__a_const static uint64_t int_sqrt(uint64_t x) { uint64_t op, res, one = 1; op = x; @@ -904,6 +904,8 @@ 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) { @@ -916,6 +918,10 @@ 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: