mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-22 00:56:22 +00:00
Minor improve theme
* Less `GString`. * Don't `g_free()` a `strdup()`'ed string. * Don't lookup the `console` window X times, but only once. Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
This commit is contained in:
@@ -666,25 +666,17 @@ _theme_prep_fgnd(char* setting, GString* lookup_str, gboolean* bold)
|
||||
}
|
||||
}
|
||||
|
||||
char*
|
||||
gchar*
|
||||
theme_get_string(char* str)
|
||||
{
|
||||
gchar* res = g_key_file_get_string(theme, "colours", str, NULL);
|
||||
if (!res) {
|
||||
return strdup(g_hash_table_lookup(defaults, str));
|
||||
return g_strdup(g_hash_table_lookup(defaults, str));
|
||||
} else {
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
theme_free_string(char* str)
|
||||
{
|
||||
if (str) {
|
||||
g_free(str);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
theme_hash_attrs(const char* str)
|
||||
{
|
||||
|
||||
@@ -152,7 +152,6 @@ void theme_close(void);
|
||||
int theme_hash_attrs(const char* str);
|
||||
int theme_attrs(theme_item_t attrs);
|
||||
char* theme_get_string(char* str);
|
||||
void theme_free_string(char* str);
|
||||
theme_item_t theme_main_presence_attrs(const char* const presence);
|
||||
theme_item_t theme_roster_unread_presence_attrs(const char* const presence);
|
||||
theme_item_t theme_roster_active_presence_attrs(const char* const presence);
|
||||
|
||||
Reference in New Issue
Block a user