changeset 2587:de3d0a24ee1b

Simplified njs_object_prop_t. Removed enum_in_object_hash which is only set when prop->type is NJS_WHITEOUT and this check can be used instead.
author Vadim Zhestikov <v.zhestikov@f5.com>
date Fri, 06 Jun 2025 16:45:15 -0700
parents 7fe4d4dbfbff
children 2f884aca1644
files src/njs_object.c src/njs_object_prop.c src/njs_value.c src/njs_value.h
diffstat 4 files changed, 2 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/src/njs_object.c	Thu Jun 12 08:34:17 2025 -0700
+++ b/src/njs_object.c	Fri Jun 06 16:45:15 2025 -0700
@@ -993,13 +993,7 @@
 
                 njs_object_prop_t *hash_prop = lhq.value;
 
-                /* select names of prop which are not deleted and
-                 * not deleted and created again i.e.,
-                 * they are replaced shared hash props
-                 */
-                if (hash_prop->type != NJS_WHITEOUT &&
-                    !(hash_prop->enum_in_object_hash))
-                {
+                if (hash_prop->type != NJS_WHITEOUT) {
                     njs_process_prop(vm, &prop_name, flags, items_string,
                                      items_symbol);
                 }
@@ -1060,8 +1054,7 @@
             } else {
                 /* prop is:  in_hash && in_shared_hash */
 
-                /* select names of not deleted and created again */
-                if (prop->enum_in_object_hash) {
+                if (prop->type == NJS_WHITEOUT) {
                     njs_process_prop(vm, &prop_name, flags, items_string,
                                      items_symbol);
                 }
--- a/src/njs_object_prop.c	Thu Jun 12 08:34:17 2025 -0700
+++ b/src/njs_object_prop.c	Fri Jun 06 16:45:15 2025 -0700
@@ -58,7 +58,6 @@
     }
 
     prop->type = type;
-    prop->enum_in_object_hash = 0;
 
     if (flags != NJS_OBJECT_PROP_UNSET) {
         prop->enumerable = !!(flags & NJS_OBJECT_PROP_ENUMERABLE);
--- a/src/njs_value.c	Thu Jun 12 08:34:17 2025 -0700
+++ b/src/njs_value.c	Fri Jun 06 16:45:15 2025 -0700
@@ -1452,7 +1452,6 @@
     }
 
     prop->type = NJS_WHITEOUT;
-    prop->enum_in_object_hash = 1;
 
     return NJS_OK;
 }
--- a/src/njs_value.h	Thu Jun 12 08:34:17 2025 -0700
+++ b/src/njs_value.h	Fri Jun 06 16:45:15 2025 -0700
@@ -339,7 +339,6 @@
 #define njs_prop_setter(_p)     (_p)->u.accessor.setter
 
     njs_object_prop_type_t      type:8;          /* 3 bits */
-    njs_object_prop_type_t      enum_in_object_hash:8; /* 3 bits */
 
     njs_object_attribute_t      writable:8;      /* 2 bits */
     njs_object_attribute_t      enumerable:8;    /* 2 bits */