]> git.kaiwu.me - njs.git/commitdiff
Leaving consistency checks as asserts for njs_scope_index().
authorDmitry Volyntsev <xeioex@nginx.com>
Thu, 12 May 2022 00:51:17 +0000 (17:51 -0700)
committerDmitry Volyntsev <xeioex@nginx.com>
Thu, 12 May 2022 00:51:17 +0000 (17:51 -0700)
src/njs_scope.h

index e7bfa7c84e1a01dff053b5c941810af6c4efc0d3..41646171c53c3caa5e4ecc6be37ea7d4d300936d 100644 (file)
@@ -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;
     }