[njs] Leaving consistency checks as asserts for njs_scope_index().
Dmitry Volyntsev
xeioex at nginx.com
Thu May 12 04:09:12 UTC 2022
details: https://hg.nginx.org/njs/rev/4c8487fb0ca8
branches:
changeset: 1854:4c8487fb0ca8
user: Dmitry Volyntsev <xeioex at nginx.com>
date: Wed May 11 17:51:17 2022 -0700
description:
Leaving consistency checks as asserts for njs_scope_index().
diffstat:
src/njs_scope.h | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diffs (17 lines):
diff -r 34af2730bf97 -r 4c8487fb0ca8 src/njs_scope.h
--- a/src/njs_scope.h Wed May 11 16:33:46 2022 -0700
+++ b/src/njs_scope.h Wed May 11 17:51:17 2022 -0700
@@ -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;
}
More information about the nginx-devel
mailing list