Simplify sanitize_to_string further

This commit is contained in:
twinaphex 2018-01-18 06:32:50 +01:00
parent 1679124361
commit 2d9727f499

View File

@ -31,8 +31,6 @@
static void sanitize_to_string(char *s, const char *label, size_t len)
{
char *pos = NULL;
if (string_is_empty(label) || !s)
return;
strlcpy(s, label, len);
@ -51,14 +49,17 @@ static int fill_title(char *s, const char *title, const char *path, size_t len)
static int action_get_title_action_generic(const char *path, const char *label,
unsigned menu_type, char *s, size_t len)
{
sanitize_to_string(s, label, len);
if (s && !string_is_empty(label))
sanitize_to_string(s, label, len);
return 0;
}
#define default_title_macro(func_name, lbl) \
static int (func_name)(const char *path, const char *label, unsigned menu_type, char *s, size_t len) \
{ \
sanitize_to_string(s, msg_hash_to_str(lbl), len); \
const char *str = msg_hash_to_str(lbl); \
if (s && !string_is_empty(str)) \
sanitize_to_string(s, str, len); \
return 0; \
}