Welcome! Log In Create A New Profile

Advanced

[njs] Leaving consistency checks as asserts for njs_scope_index().

Dmitry Volyntsev
May 12, 2022 12:12AM
details: https://hg.nginx.org/njs/rev/4c8487fb0ca8
branches:
changeset: 1854:4c8487fb0ca8
user: Dmitry Volyntsev <xeioex@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;
}

_______________________________________________
nginx-devel mailing list -- nginx-devel@nginx.org
To unsubscribe send an email to nginx-devel-leave@nginx.org
Subject Author Views Posted

[njs] Leaving consistency checks as asserts for njs_scope_index().

Dmitry Volyntsev 130 May 12, 2022 12:12AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 78
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready