aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/log.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/common/log.c b/common/log.c
index d22683b..4b6f3fc 100644
--- a/common/log.c
+++ b/common/log.c
@@ -13,7 +13,7 @@
DECLARE_GLOBAL_DATA_PTR;
-static const char *const log_cat_name[LOGC_COUNT - LOGC_NONE] = {
+static const char *const log_cat_name[] = {
"none",
"arch",
"board",
@@ -28,7 +28,10 @@ static const char *const log_cat_name[LOGC_COUNT - LOGC_NONE] = {
"acpi",
};
-static const char *const log_level_name[LOGL_COUNT] = {
+_Static_assert(ARRAY_SIZE(log_cat_name) == LOGC_COUNT - LOGC_NONE,
+ "log_cat_name size");
+
+static const char *const log_level_name[] = {
"EMERG",
"ALERT",
"CRIT",
@@ -41,6 +44,8 @@ static const char *const log_level_name[LOGL_COUNT] = {
"IO",
};
+_Static_assert(ARRAY_SIZE(log_level_name) == LOGL_COUNT, "log_level_name size");
+
/* All error responses MUST begin with '<' */
const char *log_get_cat_name(enum log_category_t cat)
{