+static int check_mood(struct osl_row *mood_row, void *data)
+{
+ struct para_buffer *pb = data;
+ char *mood_name;
+ struct osl_object mood_def;
+ struct mood_line_parser_data mlpd = {.line_num = 0};
+
+ int ret = mood_get_name_and_def_by_row(mood_row, &mood_name, &mood_def);
+
+ if (ret < 0) {
+ para_printf(pb, "failed to get mood definition\n");
+ return ret;
+ }
+ if (!*mood_name) /* ignore dummy row */
+ goto out;
+ para_printf(pb, "checking mood %s...\n", mood_name);
+ ret = for_each_line_ro(mood_def.data, mood_def.size,
+ parse_mood_line, &mlpd);
+ if (ret < 0)
+ para_printf(pb, "%s line %u: %s\n", mood_name, mlpd.line_num,
+ PARA_STRERROR(-ret));
+out:
+ osl_close_disk_object(&mood_def);
+ return 1;
+}
+
+/**
+ * Check all moods for syntax errors.
+ *
+ * \param query Unused.
+ * \param result: Contains check messages.
+ */
+int mood_check_callback(__a_unused const struct osl_object *query,
+ struct osl_object *result)
+{
+ struct para_buffer pb = {.buf = NULL};
+
+ para_printf(&pb, "checking moods...\n");
+ osl_rbtree_loop(moods_table, BLOBCOL_ID, &pb,
+ check_mood);
+ result->data = pb.buf;
+ result->size = pb.size;
+ return 1;
+}
+