From 18bd03d31aef55778224b8d86e5ba140d596527d Mon Sep 17 00:00:00 2001 From: nanahi <130121847+na-na-hi@users.noreply.github.com> Date: Fri, 8 Mar 2024 02:22:47 -0500 Subject: [PATCH] common/msg: fix warning: void function should not return void expression --- common/msg.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/common/msg.c b/common/msg.c index 1b9a6ba982..0d77fcc624 100644 --- a/common/msg.c +++ b/common/msg.c @@ -299,15 +299,18 @@ bool mp_msg_has_status_line(struct mpv_global *global) static void set_term_color(void *talloc_ctx, bstr *text, int c) { - return c == -1 ? bstr_xappend(talloc_ctx, text, bstr0("\033[0m")) - : bstr_xappend_asprintf(talloc_ctx, text, - "\033[%d;3%dm", c >> 3, c & 7); + if (c == -1) { + bstr_xappend(talloc_ctx, text, bstr0("\033[0m")); + return; + } + + bstr_xappend_asprintf(talloc_ctx, text, "\033[%d;3%dm", c >> 3, c & 7); } static void set_msg_color(void *talloc_ctx, bstr *text, int lev) { static const int v_colors[] = {9, 1, 3, -1, -1, 2, 8, 8, 8, -1}; - return set_term_color(talloc_ctx, text, v_colors[lev]); + set_term_color(talloc_ctx, text, v_colors[lev]); } static void pretty_print_module(struct mp_log_root *root, bstr *text,