Skip to content

Commit

Permalink
arraysize
Browse files Browse the repository at this point in the history
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
  • Loading branch information
alyssawilk committed Nov 2, 2023
1 parent 4cb2523 commit 33f07b3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions mobile/library/cc/log_level.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <stdexcept>

#include "source/common/common/assert.h"
#include "source/common/common/macros.h"

namespace Envoy {
namespace Platform {
Expand All @@ -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) {
Expand All @@ -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
Expand Down

0 comments on commit 33f07b3

Please sign in to comment.