Since the score table has only volatile columns, the only possible
error is memory exhaustion, in which case we can only abort
anyway. This patch changes score_open() to abort if osl_open()
fails. This allows us to let score_clear() return void. We can't get
rid of the return value of score_open(), however, since a pointer to
this function is stored the afs table operations structure.
ret = lls_deserialize_parse_result(aca->query.data, cmd, &aca->lpr);
assert(ret >= 0);
arg = lls_input(0, aca->lpr);
- ret = clear_score_table();
- if (ret < 0) {
- para_printf(&aca->pbout, "could not clear score table\n");
- goto free_lpr;
- }
+ score_clear();
if (current_play_mode == PLAY_MODE_MOOD)
close_current_mood();
else
int score_add(const struct osl_row *row, long score);
int score_update(const struct osl_row *aft_row, long new_score);
int score_delete(const struct osl_row *aft_row);
-int clear_score_table(void);
+void score_clear(void);
bool row_belongs_to_score_table(const struct osl_row *aft_row);
/* attribute */
char *mood_name = NULL;
assert(current_mood);
- ret = clear_score_table();
- if (ret < 0)
- return ret;
+ score_clear();
PARA_NOTICE_LOG("reloading %s\n", current_mood->name?
current_mood->name : "(dummy)");
if (current_mood->name)
static int score_open(__a_unused const char *dir)
{
- return osl(osl_open_table(&score_table_desc, &score_table));
+ assert(osl_open_table(&score_table_desc, &score_table) >= 0);
+ return 1;
}
/**
* Remove all entries from the score table, but keep the table open.
- *
- * \return Standard.
*/
-int clear_score_table(void)
+void score_clear(void)
{
score_close();
- return score_open(NULL);
+ score_open(NULL);
}
/** The score table stores (aft row, score) pairs in memory. */