The following commit will use a designated initializer to initialize a 'struct object_info'. This obviously depends on having the rest of the fields having a default value of zero, since unspecified fields in a designated initializer are zero'd out. Before writing that designated initializer, I wondered if there were other spots that also use designated initializers to set up object_info structs, and there are a handful. To prevent potential breakage against future object_info changes that would introduce/change a field to have a non-zero default value, note this dependency in a comment near the OBJECT_INFO_INIT macro. Signed-off-by: Taylor Blau <me@xxxxxxxxxxxx> --- object-store-ll.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/object-store-ll.h b/object-store-ll.h index cd3bd5bd99..7ff180d7f2 100644 --- a/object-store-ll.h +++ b/object-store-ll.h @@ -337,6 +337,14 @@ struct object_info { /* * Initializer for a "struct object_info" that wants no items. You may * also memset() the memory to all-zeroes. + * + * NOTE: callers expect the initial value of an object_info struct to + * be zero'd out. Designated initializers like + * + * struct object_info oi = { .sizep = &sz }; + * + * depend on this behavior, so consider strongly before adding new + * fields that have a non-zero default value. */ #define OBJECT_INFO_INIT { 0 } -- 2.49.0.229.gc267761125.dirty