/* score */
void score_init(struct afs_table *t);
-int admissible_file_loop(void *data, osl_rbtree_loop_func *func);
+int score_loop(osl_rbtree_loop_func *func, void *data);
int score_get_best(struct osl_row **aft_row, long *score);
int get_score_and_aft_row(struct osl_row *score_row, long *score, struct osl_row **aft_row);
int score_add(const struct osl_row *row, long score);
aca->pbout.flags = (opts->mode == LS_MODE_PARSER)? PBF_SIZE_PREFIX : 0;
if (admissible_only(opts))
- ret = admissible_file_loop(opts, prepare_ls_row);
+ ret = score_loop(prepare_ls_row, opts);
else
ret = osl(osl_rbtree_loop(audio_file_table, AFTCOL_PATH, opts,
prepare_ls_row));
}
/**
- * Loop over all files in the score table.
+ * Call the given function for each row of the score table.
*
- * \param data A pointer to arbitrary data.
- * \param func Function to be called for each admissible file.
+ * \param func Callback, called once per row.
+ * \param data Passed verbatim to the callback.
*
- * \return The return value of the underlying call to osl_rbtree_loop().
- *
- * This is used for the ls command. The \a data parameter is passed as the
- * second argument to \a func.
+ * \return The return value of the underlying call to osl_rbtree_loop(). The
+ * loop terminates early if the callback returns negative.
*/
-int admissible_file_loop(void *data, osl_rbtree_loop_func *func)
+int score_loop(osl_rbtree_loop_func *func, void *data)
{
return osl(osl_rbtree_loop(score_table, SCORECOL_SCORE, data, func));
}