X-Git-Url: http://git.tuebingen.mpg.de/?a=blobdiff_plain;ds=sidebyside;f=mood.c;h=7d207f0b965cab0c7fe6b5216d97c49e511085c9;hb=2cf578ff33b17cea17bfd52e2c084efa970faad4;hp=61332461d7bbed500723452fb956c3dd05cf416b;hpb=c64fd11b94ff98667642751fba69c60ab4af01a4;p=paraslash.git diff --git a/mood.c b/mood.c index 61332461..7d207f0b 100644 --- a/mood.c +++ b/mood.c @@ -502,8 +502,12 @@ static int load_mood(const struct osl_row *mood_row, struct mood **m) return 1; } -/* returns -E_MOOD_LOADED on _success_ to terminate the loop */ -static int mood_loop(struct osl_row *mood_row, void *data) +/* + * Calls load_mood() and reverts its error value: It returns -E_MOOD_LOADED + * on _success_, and 1 on errors. This way the loop over all moods stops at the + * first valid mood. + */ +static int load_mood_loop_func(struct osl_row *mood_row, void *data) { struct mood **m = data; int ret = load_mood(mood_row, m); @@ -518,7 +522,7 @@ static int mood_loop(struct osl_row *mood_row, void *data) static int load_first_available_mood(struct mood **m) { int ret = osl_rbtree_loop(moods_table, BLOBCOL_NAME, m, - mood_loop); + load_mood_loop_func); if (ret == -E_MOOD_LOADED) /* success */ return 1; if (ret < 0)