X-Git-Url: http://git.tuebingen.mpg.de/?a=blobdiff_plain;ds=sidebyside;f=score.c;fp=score.c;h=edc46ed4f577435a1512be6925b63c305559c038;hb=5564863bb040e340f593b023c873457b8a5d6428;hp=8aa547ef531fe2e8f16a6248d5c3827470fe1ed9;hpb=9c4691036a9f8999ec19034fb218e8fcdc393475;p=paraslash.git diff --git a/score.c b/score.c index 8aa547ef..edc46ed4 100644 --- a/score.c +++ b/score.c @@ -132,16 +132,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 +146,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, @@ -171,7 +161,10 @@ int score_update(const struct osl_row *aft_row, long percent) 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--;