From: Arran Cudbard-Bell Date: Wed, 14 Dec 2022 23:50:34 +0000 (-0600) Subject: Shrink fr_dlist_head_t by packing the offset with num_elements X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b5c9a3cd25121;p=thirdparty%2Ffreeradius-server.git Shrink fr_dlist_head_t by packing the offset with num_elements --- 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");