Alexander Borisov
May 06, 2021 09:20AM
details: https://hg.nginx.org/njs/rev/5563f2cbce5b
branches:
changeset: 1634:5563f2cbce5b
user: Alexander Borisov <alexander.borisov@nginx.com>
date: Thu May 06 16:07:06 2021 +0300
description:
Removed unnecessary NULL checks introduced in 0a2a0b5a74f4.

Found by Coverity (CID 1478008).

diffstat:

src/njs_variable.c | 10 ++++------
1 files changed, 4 insertions(+), 6 deletions(-)

diffs (34 lines):

diff -r a0bb54faa1b2 -r 5563f2cbce5b src/njs_variable.c
--- a/src/njs_variable.c Thu May 06 16:07:05 2021 +0300
+++ b/src/njs_variable.c Thu May 06 16:07:06 2021 +0300
@@ -437,7 +437,7 @@ njs_variable_closure(njs_vm_t *vm, njs_v
njs_index_t index, prev_index, *idx;
njs_level_type_t type;
njs_rbtree_node_t *rb_node;
- njs_parser_scope_t **p, *root;
+ njs_parser_scope_t **p;
njs_parser_rbtree_node_t *parse_node, ref_node;
#define NJS_VAR_MAX_DEPTH 32
njs_parser_scope_t *list[NJS_VAR_MAX_DEPTH];
@@ -482,18 +482,16 @@ njs_variable_closure(njs_vm_t *vm, njs_v
}
}

- root = njs_function_scope(scope);
-
- if (type != NJS_LEVEL_CLOSURE && root == scope) {
+ if (type != NJS_LEVEL_CLOSURE) {
/* Create new closure for scope. */

- index = njs_scope_index(root->type, root->closures->items,
+ index = njs_scope_index(scope->type, scope->closures->items,
NJS_LEVEL_CLOSURE, var->type);
if (njs_slow_path(index == NJS_INDEX_ERROR)) {
return NJS_INDEX_ERROR;
}

- idx = njs_arr_add(root->closures);
+ idx = njs_arr_add(scope->closures);
if (njs_slow_path(idx == NULL)) {
return NJS_INDEX_ERROR;
}
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[njs] Removed unnecessary NULL checks introduced in 0a2a0b5a74f4.

Alexander Borisov 247 May 06, 2021 09:20AM



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

Online Users

Guests: 268
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready