]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Shrink fr_dlist_head_t by packing the offset with num_elements
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Wed, 14 Dec 2022 23:50:34 +0000 (17:50 -0600)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Wed, 14 Dec 2022 23:50:34 +0000 (17:50 -0600)
src/lib/util/dlist.h

index 86cbb2f647570febd0cd5d7aef54264bd93c9058..bf4b5b8975500e8f0a2686419adfa5967ec3afdf 100644 (file)
@@ -49,11 +49,17 @@ struct fr_dlist_s {
  * like at which offset the next/prev pointers can be found.
  */
 typedef struct {
-       size_t          offset;         //!< Positive offset from start of structure to #fr_dlist_t.
-       char const      *type;          //!< of items contained within the list.  Used for talloc
-                                       ///< validation.
        fr_dlist_t      entry;          //!< Struct holding the head and tail of the list.
+                                       ///< First for efficient traversal.
+
+       unsigned int    offset;         //!< Positive offset from start of structure to #fr_dlist_t.
+                                       ///< Yes, this should really be size_t, but we shave 8 bytes
+                                       ///< off each head structure by making it unsigned int.
+
        unsigned int    num_elements;   //!< Number of elements contained within the dlist.
+
+       char const      *type;          //!< of items contained within the list.  Used for talloc
+                                       ///< validation.
 } fr_dlist_head_t;
 
 static_assert(sizeof(unsigned int) >= 4, "Unsigned integer too small on this platform");