diff --git a/src/ax.h b/src/ax.h index 9c3667c..34ac88e 100644 --- a/src/ax.h +++ b/src/ax.h @@ -26,7 +26,7 @@ void ax_log(struct ax_ctxt* ax, const char* string); * -------------------------------------------------------------------------- */ void ax_begin_theme(struct ax_ctxt* ax); -void ax_end_theme(struct ax_ctxt* ax, struct ax_theme** out_thm); +struct ax_theme* ax_end_theme(struct ax_ctxt* ax); void ax_set_theme_color( struct ax_ctxt* ax, const char* cat, int64_t rgb); diff --git a/src/ctxt/ctxt.c b/src/ctxt/ctxt.c index 365dcc4..ee06ed0 100644 --- a/src/ctxt/ctxt.c +++ b/src/ctxt/ctxt.c @@ -107,7 +107,7 @@ void ax_begin_theme(struct ax_ctxt* ax) ax->thmb = ax__theme_builder_new(ax->thmb_rgn); } -void ax_end_theme(struct ax_ctxt* ax, struct ax_theme** out_thm) +struct ax_theme* ax_end_theme(struct ax_ctxt* ax) { ASSERT(ax->thmb != NULL, "`ax_end_theme' called while not building a theme"); @@ -116,10 +116,7 @@ void ax_end_theme(struct ax_ctxt* ax, struct ax_theme** out_thm) rgn_clear(ax->thmb_rgn); ax__theme_load(thm, ax__backend_msgq(ax->bac)); - - if (out_thm != NULL) { - *out_thm = thm; - } + return thm; } void ax_set_theme_color( diff --git a/test/main.c b/test/main.c index 714c353..9322e22 100644 --- a/test/main.c +++ b/test/main.c @@ -27,9 +27,7 @@ static struct ax_theme* make_example_theme() ax_set_theme_color(ax, "primary", 0x00ff00); ax_set_theme_font(ax, "default", "/usr/share/fonts/TTF/DejaVuSans.ttf", 0); ax_set_theme_font(ax, "h1", NULL, 95); - struct ax_theme* thm; - ax_end_theme(ax, &thm); - return thm; + return ax_end_theme(ax); } int main(void)