summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
40cb867)
This public function had only one caller outside of score.c and this
caller already knows the number of admissible files because this
number is also stored in the afs statistics structure.
Open-coding the remaining caller in score.c allows us to remove the
public function.
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);
int score_update(const struct osl_row *aft_row, long new_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);
int score_update(const struct osl_row *aft_row, long new_score);
-int get_num_admissible_files(unsigned *num);
int score_delete(const struct osl_row *aft_row);
int clear_score_table(void);
int row_belongs_to_score_table(const struct osl_row *aft_row, unsigned *rank);
int score_delete(const struct osl_row *aft_row);
int clear_score_table(void);
int row_belongs_to_score_table(const struct osl_row *aft_row, unsigned *rank);
static int update_afs_statistics(struct afs_info *old_afsi,
struct afs_info *new_afsi)
{
static int update_afs_statistics(struct afs_info *old_afsi,
struct afs_info *new_afsi)
{
- unsigned n;
- int ret = get_num_admissible_files(&n);
-
- if (ret < 0)
- return ret;
+ unsigned n = statistics.num;
assert(n);
statistics.last_played_qd = update_quadratic_deviation(n,
assert(n);
statistics.last_played_qd = update_quadratic_deviation(n,
.column_descriptions = score_cols
};
.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)
{
/* On errors (negative return value) the content of score is undefined. */
static int get_score_of_row(void *score_row, long *score)
{
return 1;
if (ret < 0)
return ret;
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;
if (ret < 0)
return ret;
new_pos = 1 + (n - 1) * percent / 100;