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: case AUTO:
return calculate_foreground_color(cl->bg); return calculate_foreground_color(cl->bg);
default: 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; ellipsize = PANGO_ELLIPSIZE_END;
break; break;
default: default:
assert(false); LOG_E("Invalid %s enum value in %s:%d", "ellipsize", __FILE__, __LINE__);
break;
} }
pango_layout_set_ellipsize(cl->l, ellipsize); pango_layout_set_ellipsize(cl->l, ellipsize);
} }

View File

@ -37,7 +37,8 @@ const char *enum_to_string_fullscreen(enum behavior_fullscreen in)
case FS_PUSHBACK: return "pushback"; case FS_PUSHBACK: return "pushback";
case FS_NULL: return "(null)"; case FS_NULL: return "(null)";
default: default:
LOG_E("Enum behavior_fullscreen has wrong value."); LOG_E("Invalid %s enum value in %s:%d", "fullscreen", __FILE__, __LINE__);
break;
} }
} }