[njs] Improved njs_object_enumerate().

Dmitry Volyntsev xeioex at nginx.com
Thu Mar 28 18:27:14 UTC 2019


details:   https://hg.nginx.org/njs/rev/2251d61554ac
branches:  
changeset: 858:2251d61554ac
user:      Dmitry Volyntsev <xeioex at nginx.com>
date:      Thu Mar 28 20:42:11 2019 +0300
description:
Improved njs_object_enumerate().

diffstat:

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

diffs (24 lines):

diff -r 913398656772 -r 2251d61554ac njs/njs_object.c
--- a/njs/njs_object.c	Thu Mar 28 20:31:20 2019 +0300
+++ b/njs/njs_object.c	Thu Mar 28 20:42:11 2019 +0300
@@ -1217,10 +1217,11 @@ njs_object_enumerate(njs_vm_t *vm, const
     if (nxt_fast_path(properties != 0)) {
         nxt_lvlhsh_each_init(&lhe, &njs_object_hash_proto);
 
+        hash = &value->data.u.object->hash;
+
         switch (kind) {
 
         case NJS_ENUM_KEYS:
-            hash = &value->data.u.object->hash;
             for ( ;; ) {
                 prop = nxt_lvlhsh_each(hash, &lhe);
 
@@ -1251,7 +1252,6 @@ njs_object_enumerate(njs_vm_t *vm, const
             break;
 
         case NJS_ENUM_VALUES:
-            hash = &value->data.u.object->hash;
             for ( ;; ) {
                 prop = nxt_lvlhsh_each(hash, &lhe);
 


More information about the nginx-devel mailing list