mirror of
https://github.com/libretro/RetroArch
synced 2025-03-29 22:20:21 +00:00
(menu_cbs_title.c) Cleanups
This commit is contained in:
parent
0fedbe837c
commit
ce191672f1
@ -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) \
|
||||
|
Loading…
x
Reference in New Issue
Block a user