[njs] Inlining call to hash function in njs_property_query().

Dmitry Volyntsev xeioex at nginx.com
Fri Jul 19 20:28:16 UTC 2019


details:   https://hg.nginx.org/njs/rev/9da8ebc3dc07
branches:  
changeset: 1063:9da8ebc3dc07
user:      Dmitry Volyntsev <xeioex at nginx.com>
date:      Fri Jul 19 23:27:53 2019 +0300
description:
Inlining call to hash function in njs_property_query().

diffstat:

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

diffs (29 lines):

diff -r 8b977c78885f -r 9da8ebc3dc07 njs/njs_object_property.c
--- a/njs/njs_object_property.c	Fri Jul 19 22:05:34 2019 +0300
+++ b/njs/njs_object_property.c	Fri Jul 19 23:27:53 2019 +0300
@@ -49,7 +49,6 @@ njs_property_query(njs_vm_t *vm, njs_pro
     const njs_value_t *property)
 {
     uint32_t        index;
-    uint32_t        (*hash)(const void *, size_t);
     njs_ret_t       ret;
     njs_object_t    *obj;
     njs_value_t     prop;
@@ -64,8 +63,6 @@ njs_property_query(njs_vm_t *vm, njs_pro
         property = ∝
     }
 
-    hash = nxt_djb_hash;
-
     switch (object->type) {
 
     case NJS_BOOLEAN:
@@ -140,7 +137,7 @@ njs_property_query(njs_vm_t *vm, njs_pro
     if (nxt_fast_path(ret == NXT_OK)) {
 
         njs_string_get(&pq->value, &pq->lhq.key);
-        pq->lhq.key_hash = hash(pq->lhq.key.start, pq->lhq.key.length);
+        pq->lhq.key_hash = nxt_djb_hash(pq->lhq.key.start, pq->lhq.key.length);
 
         if (obj == NULL) {
             pq->own = 1;


More information about the nginx-devel mailing list