]> git.kaiwu.me - njs.git/commitdiff
Removed dead store assignment after 1d0825906438.
authorDmitry Volyntsev <xeioex@nginx.com>
Tue, 26 May 2020 19:03:11 +0000 (19:03 +0000)
committerDmitry Volyntsev <xeioex@nginx.com>
Tue, 26 May 2020 19:03:11 +0000 (19:03 +0000)
Found with Clang Static Analyzer.

src/njs_array.c

index c1acc6b90c846ee22d8e3c44f73c028c47aa6566..ce449666de63afd457d8e693033c6d645b2d66a8 100644 (file)
@@ -3219,7 +3219,7 @@ njs_array_prototype_sort(njs_vm_t *vm, njs_value_t *args, njs_uint_t nargs,
     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, njs_value_t *args, njs_uint_t nargs,
 
         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;