diff --git a/menu/cbs/menu_cbs_title.c b/menu/cbs/menu_cbs_title.c index e4f9b20ffa..a8d3b22299 100644 --- a/menu/cbs/menu_cbs_title.c +++ b/menu/cbs/menu_cbs_title.c @@ -30,29 +30,19 @@ cbs->action_get_title_ident = #name; #endif -static void sanitize_to_string(char *s, const char *label, size_t len) -{ - char *pos = NULL; - - strlcpy(s, label, len); - - /* replace characters */ - while((pos = strchr(s, '_'))) - *pos = ' '; -} - -static int fill_title(char *s, const char *title, const char *path, size_t len) -{ - if (!string_is_empty(path) && !string_is_empty(title)) - fill_pathname_join_delim(s, title, path, ' ', len); - return 0; -} +#define sanitize_to_string(s, label, len) \ + char *pos = NULL; \ + strlcpy(s, label, len); \ + while((pos = strchr(s, '_'))) \ + *pos = ' ' static int action_get_title_action_generic(const char *path, const char *label, unsigned menu_type, char *s, size_t len) { if (s && !string_is_empty(label)) + { sanitize_to_string(s, label, len); + } return 0; } @@ -61,14 +51,19 @@ static int action_get_title_action_generic(const char *path, const char *label, { \ const char *str = msg_hash_to_str(lbl); \ if (s && !string_is_empty(str)) \ + { \ sanitize_to_string(s, str, len); \ + } \ return 0; \ } #define default_fill_title_macro(func_name, lbl) \ static int (func_name)(const char *path, const char *label, unsigned menu_type, char *s, size_t len) \ { \ - return fill_title(s, msg_hash_to_str(lbl), path, len); \ + const char *title = msg_hash_to_str(lbl); \ + if (!string_is_empty(path) && !string_is_empty(title)) \ + fill_pathname_join_delim(s, title, path, ' ', len); \ + return 0; \ } #define default_title_copy_macro(func_name, lbl) \