]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
Rename admissible_file_loop() -> score_loop().
authorAndre Noll <maan@tuebingen.mpg.de>
Tue, 8 Mar 2022 19:47:59 +0000 (20:47 +0100)
committerAndre Noll <maan@tuebingen.mpg.de>
Mon, 17 Oct 2022 18:36:21 +0000 (20:36 +0200)
The function simply iterates the entries of the score table. The new
name is shorter, more to the point, and indicates that the function
is implemented in score.c.

Streamline the documentation while at it and swap the arguments,
as the reversed order is more natural.

afs.h
aft.c
score.c

diff --git a/afs.h b/afs.h
index a8ba3c451e1d7621c5ec30627f1f959ca27621a6..43eb8f75855bb7082079194e0a32271e2ff9bf59 100644 (file)
--- a/afs.h
+++ b/afs.h
@@ -234,7 +234,7 @@ int for_each_matching_row(struct pattern_match_data *pmd);
 
 /* 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);
diff --git a/aft.c b/aft.c
index f690e81951b4c7911c2f726b36fee9a673badce7..1f1e1198d50c66c7723d22453f8d3b848cc7b2b7 100644 (file)
--- a/aft.c
+++ b/aft.c
@@ -1375,7 +1375,7 @@ static int com_ls_callback(struct afs_callback_arg *aca)
 
        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));
diff --git a/score.c b/score.c
index 2f49b104027ecbfc7fcd696deeb71ff6d417ced8..19cfef86212dd867d6dea3c924a0f40ca897a2cd 100644 (file)
--- a/score.c
+++ b/score.c
@@ -196,17 +196,15 @@ static int get_score_row_from_aft_row(const struct osl_row *aft_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));
 }