[njs] Removed dead store assignment after 1d0825906438.

Dmitry Volyntsev xeioex at nginx.com
Wed May 27 13:39:49 UTC 2020


details:   https://hg.nginx.org/njs/rev/1b8a0af35e2b
branches:  
changeset: 1403:1b8a0af35e2b
user:      Dmitry Volyntsev <xeioex at nginx.com>
date:      Tue May 26 19:03:11 2020 +0000
description:
Removed dead store assignment after 1d0825906438.

Found with Clang Static Analyzer.

diffstat:

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

diffs (29 lines):

diff -r 164801c99e9a -r 1b8a0af35e2b src/njs_array.c
--- a/src/njs_array.c	Tue May 26 19:02:57 2020 +0000
+++ b/src/njs_array.c	Tue May 26 19:03:11 2020 +0000
@@ -3219,7 +3219,7 @@ njs_array_prototype_sort(njs_vm_t *vm, n
     int64_t                i, und, inv, len, nlen, length;
     njs_int_t              ret;
     njs_array_t            *array;
-    njs_value_t            *this, *comparefn, *start, *strings, value;
+    njs_value_t            *this, *comparefn, *start, *strings;
     njs_array_sort_ctx_t   ctx;
     njs_array_sort_slot_t  *p, *end, *slots, *nslots;
 
@@ -3271,15 +3271,13 @@ njs_array_prototype_sort(njs_vm_t *vm, n
 
         for (i = length - 1; i >= 0; i--) {
             if (njs_is_undefined(&start[i])) {
-                value = start[i];
                 start[i] = start[inv - und - 1];
-                start[inv - und - 1] = value;
+                start[inv - und - 1] = njs_value_undefined;
                 und++;
                 continue;
             }
 
             if (!njs_is_valid(&start[i])) {
-                value = start[i];
                 start[i] = start[inv - und - 1];
                 start[inv - und - 1] = njs_value_undefined;
                 start[inv - 1] = njs_value_invalid;


More information about the nginx-devel mailing list