From: Andre Noll Date: Tue, 8 Mar 2022 22:55:26 +0000 (+0100) Subject: mood.c: Remove row_is_admissible(). X-Git-Tag: v0.7.2~14^2~25 X-Git-Url: https://git.tuebingen.mpg.de/?a=commitdiff_plain;h=501b83a39828c9d3db5498c7352a2e5b60175bba;p=paraslash.git mood.c: Remove row_is_admissible(). The function has become trivial, so open-code the one-liner twice. Since mp_eval_row() returns bool and never fails, the comment was misleading and the error checking unnecessary. --- diff --git a/mood.c b/mood.c index acf8e2ad..a58284a7 100644 --- a/mood.c +++ b/mood.c @@ -119,13 +119,6 @@ __a_const static uint64_t int_sqrt(uint64_t x) return res; } -/* returns 1 if row admissible, 0 if not, negative on errors */ -static int row_is_admissible(const struct osl_row *aft_row, struct mood *m) -{ - assert(m); - return mp_eval_row(aft_row, m->parser_context); -} - static void destroy_mood(struct mood *m) { if (!m) @@ -354,11 +347,9 @@ struct admissible_array { static int add_if_admissible(struct osl_row *aft_row, void *data) { struct admissible_array *aa = data; - int ret; - ret = row_is_admissible(aft_row, aa->m); - if (ret <= 0) - return ret; + if (!mp_eval_row(aft_row, aa->m->parser_context)) + return 0; if (statistics.num >= aa->size) { aa->size *= 2; aa->size += 100; @@ -499,10 +490,7 @@ static int mood_update_audio_file(const struct osl_row *aft_row, if (ret < 0) return ret; was_admissible = ret; - ret = row_is_admissible(aft_row, current_mood); - if (ret < 0) - return ret; - is_admissible = (ret > 0); + is_admissible = mp_eval_row(aft_row, current_mood->parser_context); if (!was_admissible && !is_admissible) return 1; if (was_admissible && !is_admissible)