[njs] Moving common code to njs_array_iterator_args().

Igor Sysoev igor at sysoev.ru
Tue Apr 4 10:24:42 UTC 2017


details:   http://hg.nginx.org/njs/rev/a4e6f27ce598
branches:  
changeset: 335:a4e6f27ce598
user:      Igor Sysoev <igor at sysoev.ru>
date:      Tue Apr 04 10:56:33 2017 +0300
description:
Moving common code to njs_array_iterator_args().

diffstat:

 njs/njs_array.c |  5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)

diffs (43 lines):

diff -r 9d211a93c491 -r a4e6f27ce598 njs/njs_array.c
--- a/njs/njs_array.c	Tue Apr 04 10:52:24 2017 +0300
+++ b/njs/njs_array.c	Tue Apr 04 10:56:33 2017 +0300
@@ -1266,7 +1266,6 @@ njs_array_prototype_some(njs_vm_t *vm, n
 
     iter = njs_vm_continuation(vm);
     iter->u.cont.function = njs_array_prototype_some_continuation;
-    iter->retval.data.truth = 0;
 
     return njs_array_prototype_some_continuation(vm, args, nargs, unused);
 }
@@ -1429,7 +1428,6 @@ njs_array_prototype_filter(njs_vm_t *vm,
 
     filter = njs_vm_continuation(vm);
     filter->iter.u.cont.function = njs_array_prototype_filter_continuation;
-    filter->iter.retval.data.truth = 0;
 
     filter->array = njs_array_alloc(vm, 0, NJS_ARRAY_SPARE);
     if (nxt_slow_path(filter->array == NULL)) {
@@ -1490,7 +1488,6 @@ njs_array_prototype_find(njs_vm_t *vm, n
 
     find = njs_vm_continuation(vm);
     find->iter.u.cont.function = njs_array_prototype_find_continuation;
-    find->iter.retval.data.truth = 0;
 
     return njs_array_prototype_find_continuation(vm, args, nargs, unused);
 }
@@ -1547,7 +1544,6 @@ njs_array_prototype_find_index(njs_vm_t 
 
     iter = njs_vm_continuation(vm);
     iter->u.cont.function = njs_array_prototype_find_index_continuation;
-    iter->retval.data.truth = 0;
 
     return njs_array_prototype_find_index_continuation(vm, args, nargs, unused);
 }
@@ -1770,6 +1766,7 @@ njs_array_iterator_args(njs_vm_t *vm, nj
 
         iter = njs_vm_continuation(vm);
         iter->length = args[0].data.u.array->length;
+        iter->retval.data.truth = 0;
         iter->index = NJS_ARRAY_INVALID_INDEX;
 
         return NXT_OK;


More information about the nginx-devel mailing list