mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Use log_error() instead of g_warning()
This commit is contained in:
parent
f0495affa4
commit
0b9880f7a0
@ -334,17 +334,20 @@ static int find_col(const char *col_name, int n)
|
||||
|
||||
if (n >= sizeof(name)) {
|
||||
/* truncate */
|
||||
g_warning("<%s,%d> bigger than %zu", col_name, n, sizeof(name));
|
||||
log_error("Color: <%s,%d> bigger than %zu", col_name, n, sizeof(name));
|
||||
n = sizeof(name)-1;
|
||||
}
|
||||
memcpy(name, col_name, n);
|
||||
|
||||
if (g_ascii_strcasecmp(name, "default") == 0)
|
||||
if (g_ascii_strcasecmp(name, "default") == 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (i = 0; i < COLOR_NAME_SIZE; i++)
|
||||
if (g_ascii_strcasecmp(name, color_names[i]) == 0)
|
||||
for (i = 0; i < COLOR_NAME_SIZE; i++) {
|
||||
if (g_ascii_strcasecmp(name, color_names[i]) == 0) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return COL_ERR;
|
||||
}
|
||||
@ -383,14 +386,14 @@ int color_pair_cache_get(const char *pair_name)
|
||||
|
||||
sep = strchr(pair_name, '_');
|
||||
if (!sep) {
|
||||
g_warning("color pair %s missing _", pair_name);
|
||||
log_error("Color: color pair %s missing", pair_name);
|
||||
return -1;
|
||||
}
|
||||
|
||||
fg = find_col(pair_name, sep - pair_name);
|
||||
bg = find_col(sep+1, strlen(sep));
|
||||
if (fg == COL_ERR || bg == COL_ERR) {
|
||||
g_warning("bad color name %s", pair_name);
|
||||
log_error("Color: bad color name %s", pair_name);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -402,7 +405,7 @@ int color_pair_cache_get(const char *pair_name)
|
||||
/* otherwise cache new pair */
|
||||
|
||||
if (cache.size >= cache.capacity) {
|
||||
g_warning("reached ncurses color pair cache of %d", COLOR_PAIRS);
|
||||
log_error("Color: reached ncurses color pair cache of %d", COLOR_PAIRS);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -807,7 +807,7 @@ theme_attrs(theme_item_t attrs)
|
||||
// lookup colour pair
|
||||
result = color_pair_cache_get(lookup_str->str);
|
||||
if (result < 0) {
|
||||
g_warning("invalid color <%s>", lookup_str->str);
|
||||
log_error("Invalid color <%s>", lookup_str->str);
|
||||
result = 0;
|
||||
}
|
||||
g_string_free(lookup_str, TRUE);
|
||||
|
Loading…
Reference in New Issue
Block a user