[njs] Fixed njs_object_hash_create() for 0 elements.

Dmitry Volyntsev xeioex at nginx.com
Fri Mar 23 11:22:23 UTC 2018


details:   http://hg.nginx.org/njs/rev/9dfa2e1892d0
branches:  
changeset: 470:9dfa2e1892d0
user:      Dmitry Volyntsev <xeioex at nginx.com>
date:      Fri Mar 23 14:03:09 2018 +0300
description:
Fixed njs_object_hash_create() for 0 elements.

diffstat:

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

diffs (21 lines):

diff -r 567cdbcee5ce -r 9dfa2e1892d0 njs/njs_object.c
--- a/njs/njs_object.c	Fri Mar 23 14:02:22 2018 +0300
+++ b/njs/njs_object.c	Fri Mar 23 14:03:09 2018 +0300
@@ -111,7 +111,7 @@ njs_object_hash_create(njs_vm_t *vm, nxt
     lhq.proto = &njs_object_hash_proto;
     lhq.pool = vm->mem_cache_pool;
 
-    do {
+    while (n != 0) {
         njs_string_get(&prop->name, &lhq.key);
         lhq.key_hash = nxt_djb_hash(lhq.key.start, lhq.key.length);
         lhq.value = (void *) prop;
@@ -123,7 +123,7 @@ njs_object_hash_create(njs_vm_t *vm, nxt
 
         prop++;
         n--;
-    } while (n != 0);
+    }
 
     return NXT_OK;
 }


More information about the nginx-devel mailing list