]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - score.c
Remove get_num_admissible_files().
[paraslash.git] / score.c
diff --git a/score.c b/score.c
index 8aa547ef531fe2e8f16a6248d5c3827470fe1ed9..2f49b104027ecbfc7fcd696deeb71ff6d417ced8 100644 (file)
--- a/score.c
+++ b/score.c
@@ -76,18 +76,6 @@ static struct osl_table_description score_table_desc = {
        .column_descriptions = score_cols
 };
 
-/**
- * Compute the number of files in score table.
- *
- * \param num Result is returned here.
- *
- * \return Positive on success, negative on errors.
- */
-int get_num_admissible_files(unsigned *num)
-{
-       return osl(osl_get_num_rows(score_table, num));
-}
-
 /* On errors (negative return value) the content of score is undefined. */
 static int get_score_of_row(void *score_row, long *score)
 {
@@ -132,16 +120,6 @@ int score_add(const struct osl_row *aft_row, long score)
        return ret;
 }
 
-static int get_nth_score(unsigned n, long *score)
-{
-       struct osl_row *row;
-       int ret = osl(osl_get_nth_row(score_table, SCORECOL_SCORE, n, &row));
-
-       if (ret < 0)
-               return ret;
-       return get_score_of_row(row, score);
-}
-
 /**
  * Replace a row of the score table.
  *
@@ -156,7 +134,7 @@ static int get_nth_score(unsigned n, long *score)
  */
 int score_update(const struct osl_row *aft_row, long percent)
 {
-       struct osl_row *row;
+       struct osl_row *row, *rrow; /* score row, reference row */
        long new_score;
        unsigned n, new_pos;
        struct osl_object obj = {.data = (struct osl_row *)aft_row,
@@ -167,11 +145,14 @@ int score_update(const struct osl_row *aft_row, long percent)
                return 1;
        if (ret < 0)
                return ret;
-       ret = get_num_admissible_files(&n);
+       ret = osl(osl_get_num_rows(score_table, &n));
        if (ret < 0)
                return ret;
        new_pos = 1 + (n - 1) * percent / 100;
-       ret = get_nth_score(new_pos, &new_score);
+       ret = osl(osl_get_nth_row(score_table, SCORECOL_SCORE, new_pos, &rrow));
+       if (ret < 0)
+               return ret;
+       ret = get_score_of_row(rrow, &new_score);
        if (ret < 0)
                return ret;
        new_score--;
@@ -321,12 +302,6 @@ int clear_score_table(void)
        return score_open(NULL);
 }
 
-static int score_event_handler(__a_unused enum afs_events event,
-               __a_unused struct para_buffer *pb, __a_unused void *data)
-{
-       return 1;
-}
-
 /**
  * Initialize the scoring subsystem.
  *
@@ -337,5 +312,4 @@ void score_init(struct afs_table *t)
        t->name = score_table_desc.name;
        t->open = score_open;
        t->close = score_close;
-       t->event_handler = score_event_handler;
 }