Canonify invalid enum values handling

This commit is contained in:
Benedikt Heine 2018-05-12 12:46:47 +02:00 committed by Nikos Tsipinakis
parent 5761ef1c09
commit 1d58d2ec87
2 changed files with 11 additions and 8 deletions

View File

@ -105,7 +105,8 @@ static color_t layout_get_sepcolor(colored_layout *cl, colored_layout *cl_next)
case AUTO:
return calculate_foreground_color(cl->bg);
default:
LOG_E("Unknown separator color type.");
LOG_E("Invalid %s enum value in %s:%d", "sep_color", __FILE__, __LINE__);
break;
}
}
@ -258,7 +259,8 @@ static colored_layout *layout_init_shared(cairo_t *c, notification *n)
ellipsize = PANGO_ELLIPSIZE_END;
break;
default:
assert(false);
LOG_E("Invalid %s enum value in %s:%d", "ellipsize", __FILE__, __LINE__);
break;
}
pango_layout_set_ellipsize(cl->l, ellipsize);
}

View File

@ -32,12 +32,13 @@ static void notification_dmenu_string(notification *n);
const char *enum_to_string_fullscreen(enum behavior_fullscreen in)
{
switch (in) {
case FS_SHOW: return "show";
case FS_DELAY: return "delay";
case FS_PUSHBACK: return "pushback";
case FS_NULL: return "(null)";
default:
LOG_E("Enum behavior_fullscreen has wrong value.");
case FS_SHOW: return "show";
case FS_DELAY: return "delay";
case FS_PUSHBACK: return "pushback";
case FS_NULL: return "(null)";
default:
LOG_E("Invalid %s enum value in %s:%d", "fullscreen", __FILE__, __LINE__);
break;
}
}