From: Dmitry Volyntsev Date: Thu, 12 May 2022 00:51:17 +0000 (-0700) Subject: Leaving consistency checks as asserts for njs_scope_index(). X-Git-Tag: 0.7.4~10 X-Git-Url: http://www.kaiwu.me/postgresql/commit/static/gitweb.js?a=commitdiff_plain;h=93ee214ca8cc95d6de48d31cccd7fabe804b10d1;p=njs.git Leaving consistency checks as asserts for njs_scope_index(). --- 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; }