From b5c9a3cd251215a83edbea17113b94f284857bf4 Mon Sep 17 00:00:00 2001 From: Arran Cudbard-Bell Date: Wed, 14 Dec 2022 17:50:34 -0600 Subject: [PATCH] Shrink fr_dlist_head_t by packing the offset with num_elements --- src/lib/util/dlist.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/lib/util/dlist.h b/src/lib/util/dlist.h index 86cbb2f6475..bf4b5b89755 100644 --- a/src/lib/util/dlist.h +++ b/src/lib/util/dlist.h @@ -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"); -- 2.47.3