[theme] use more rsprintf

This commit is contained in:
Milo Turner 2020-02-13 13:13:41 -05:00
parent 5d96bf908d
commit 344d5ca059
1 changed files with 4 additions and 8 deletions

View File

@ -124,10 +124,8 @@ void ax_set_theme_color(
ASSERT(ax->thmb != NULL, "`ax_set_theme_color' called while not building a theme");
enum ax_color_cat cat;
if (ax__string_to_color_cat(cat_name, &cat) != 0) {
#define FMT "invalid color category `%s'"
sprintf(ax__theme_make_error_buf(ax->thmb, strlen(FMT) + strlen(cat_name)),
FMT, cat_name);
#undef FMT
ax->thmb->thm.fatal_err =
rsprintf(&ax->thmb_rgn, "invalid color category `%s'", cat_name);
} else {
ax__theme_set_color(ax->thmb, cat, rgb);
}
@ -139,10 +137,8 @@ void ax_set_theme_font(
ASSERT(ax->thmb != NULL, "`ax_set_theme_font' called while not building a theme");
enum ax_font_cat cat;
if (ax__string_to_font_cat(cat_name, &cat) != 0) {
#define FMT "invalid font category `%s'"
sprintf(ax__theme_make_error_buf(ax->thmb, strlen(FMT) + strlen(cat_name)),
FMT, cat_name);
#undef FMT
ax->thmb->thm.fatal_err =
rsprintf(&ax->thmb_rgn, "invalid font category `%s'", cat_name);
} else {
ax__theme_set_font(ax->thmb, cat, fnt_path, fnt_size);
}