[njs] Removed surplus for loop.
Dmitry Volyntsev
xeioex at nginx.com
Mon Dec 24 11:00:53 UTC 2018
details: https://hg.nginx.org/njs/rev/5c8802f61ad6
branches:
changeset: 692:5c8802f61ad6
user: Dmitry Volyntsev <xeioex at nginx.com>
date: Mon Dec 24 13:59:27 2018 +0300
description:
Removed surplus for loop.
Left over after simplifications in 4e62b7a295e0.
Found by Coverity (CID 1441823).
diffstat:
njs/njs_parser_expression.c | 52 +++++++++++++++++++++-----------------------
1 files changed, 25 insertions(+), 27 deletions(-)
diffs (66 lines):
diff -r daebcd564289 -r 5c8802f61ad6 njs/njs_parser_expression.c
--- a/njs/njs_parser_expression.c Mon Dec 17 21:13:02 2018 +0200
+++ b/njs/njs_parser_expression.c Mon Dec 24 13:59:27 2018 +0300
@@ -536,37 +536,35 @@ njs_parser_exponential_expression(njs_vm
return token;
}
- for ( ;; ) {
- if (token == NJS_TOKEN_EXPONENTIATION) {
-
- node = njs_parser_node_alloc(vm);
- if (nxt_slow_path(node == NULL)) {
- return NJS_TOKEN_ERROR;
- }
-
- node->token = token;
- node->u.operation = njs_vmcode_exponentiation;
- node->scope = parser->scope;
- node->left = parser->node;
- node->left->dest = node;
+ if (token == NJS_TOKEN_EXPONENTIATION) {
- token = njs_parser_token(parser);
- if (nxt_slow_path(token <= NJS_TOKEN_ILLEGAL)) {
- return token;
- }
-
- token = njs_parser_exponential_expression(vm, parser, NULL, token);
- if (nxt_slow_path(token <= NJS_TOKEN_ILLEGAL)) {
- return token;
- }
-
- node->right = parser->node;
- node->right->dest = node;
- parser->node = node;
+ node = njs_parser_node_alloc(vm);
+ if (nxt_slow_path(node == NULL)) {
+ return NJS_TOKEN_ERROR;
}
- return token;
+ node->token = token;
+ node->u.operation = njs_vmcode_exponentiation;
+ node->scope = parser->scope;
+ node->left = parser->node;
+ node->left->dest = node;
+
+ token = njs_parser_token(parser);
+ if (nxt_slow_path(token <= NJS_TOKEN_ILLEGAL)) {
+ return token;
+ }
+
+ token = njs_parser_exponential_expression(vm, parser, NULL, token);
+ if (nxt_slow_path(token <= NJS_TOKEN_ILLEGAL)) {
+ return token;
+ }
+
+ node->right = parser->node;
+ node->right->dest = node;
+ parser->node = node;
}
+
+ return token;
}
More information about the nginx-devel
mailing list