From 93ee214ca8cc95d6de48d31cccd7fabe804b10d1 Mon Sep 17 00:00:00 2001 From: Dmitry Volyntsev Date: Wed, 11 May 2022 17:51:17 -0700 Subject: [PATCH] Leaving consistency checks as asserts for njs_scope_index(). --- src/njs_scope.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/njs_scope.h b/src/njs_scope.h index e7bfa7c8..41646171 100644 --- a/src/njs_scope.h +++ b/src/njs_scope.h @@ -30,9 +30,10 @@ njs_inline njs_index_t njs_scope_index(njs_scope_t scope, njs_index_t index, njs_level_type_t type, njs_variable_type_t var_type) { - if (index > NJS_SCOPE_VALUE_MAX || type >= NJS_LEVEL_MAX - || (scope != NJS_SCOPE_GLOBAL && scope != NJS_SCOPE_FUNCTION)) - { + njs_assert(type < NJS_LEVEL_MAX); + njs_assert(scope == NJS_SCOPE_GLOBAL || scope == NJS_SCOPE_FUNCTION); + + if (index > NJS_SCOPE_VALUE_MAX) { return NJS_INDEX_ERROR; } -- 2.47.3