From 33f07b33893b24fd3994c1258528a9c84ea02c82 Mon Sep 17 00:00:00 2001 From: Alyssa Wilk Date: Thu, 2 Nov 2023 08:52:06 -0400 Subject: [PATCH] arraysize Signed-off-by: Alyssa Wilk --- mobile/library/cc/log_level.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mobile/library/cc/log_level.cc b/mobile/library/cc/log_level.cc index 94f718c7de87..6ef08f173389 100644 --- a/mobile/library/cc/log_level.cc +++ b/mobile/library/cc/log_level.cc @@ -3,6 +3,7 @@ #include #include "source/common/common/assert.h" +#include "source/common/common/macros.h" namespace Envoy { namespace Platform { @@ -21,7 +22,7 @@ std::string logLevelToString(LogLevel method) { } IS_ENVOY_BUG("unknown log level, defaulting to off"); - return LOG_LEVEL_LOOKUP[6].second; + return LOG_LEVEL_LOOKUP[ARRAY_SIZE(LOG_LEVEL_LOOKUP) - 1].second; } LogLevel logLevelFromString(const std::string& str) { @@ -32,7 +33,7 @@ LogLevel logLevelFromString(const std::string& str) { } IS_ENVOY_BUG("unknown log level, defaulting to off"); - return LOG_LEVEL_LOOKUP[6].first; + return LOG_LEVEL_LOOKUP[ARRAY_SIZE(LOG_LEVEL_LOOKUP) -1 ].first; } } // namespace Platform