From: Andre Noll Date: Tue, 25 Sep 2007 11:02:26 +0000 (+0200) Subject: mood.c: Rename mood_loop() to load_mood_loop_func(). X-Git-Tag: v0.3.0~350 X-Git-Url: http://git.tuebingen.mpg.de/?a=commitdiff_plain;h=2cf578ff33b17cea17bfd52e2c084efa970faad4;p=paraslash.git mood.c: Rename mood_loop() to load_mood_loop_func(). And add a comment that describes why this function returns negative on success, and positive on errors. --- 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)