From: Alex Richardson Date: Fri, 12 Aug 2022 10:34:06 +0000 (+0000) Subject: dbus-marshal-recursive.h: reduce padding in DBusType{Reader,Writer} X-Git-Tag: dbus-1.15.0~4^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=91f4ac9cf62f8bb99c28ddfa4f376e45fd1b2b94;p=thirdparty%2Fdbus.git dbus-marshal-recursive.h: reduce padding in DBusType{Reader,Writer} When building for Arm Morello (where pointers are 16 bytes), I hit the static assertion that sizeof (DBusMessageRealIter) <= sizeof (DBusMessageIter) inside _dbus_message_iter_init_common() otherwise. This can be fixed by moving the pointers to the beginning of the struct to remove padding. --- diff --git a/dbus/dbus-marshal-recursive.h b/dbus/dbus-marshal-recursive.h index c3b96819d..5822e058f 100644 --- a/dbus/dbus-marshal-recursive.h +++ b/dbus/dbus-marshal-recursive.h @@ -38,18 +38,19 @@ typedef struct DBusArrayLenFixup DBusArrayLenFixup; */ struct DBusTypeReader { + const DBusTypeReaderClass *klass; /**< the vtable for the reader */ + const DBusString *type_str; /**< string containing signature of block */ + const DBusString *value_str; /**< string containing values of block */ + dbus_uint32_t byte_order : 8; /**< byte order of the block */ dbus_uint32_t finished : 1; /**< marks we're at end iterator for cases * where we don't have another way to tell */ dbus_uint32_t array_len_offset : 3; /**< bytes back from start_pos that len ends */ - const DBusString *type_str; /**< string containing signature of block */ int type_pos; /**< current position in signature */ - const DBusString *value_str; /**< string containing values of block */ int value_pos; /**< current position in values */ - const DBusTypeReaderClass *klass; /**< the vtable for the reader */ union { struct { @@ -63,6 +64,8 @@ struct DBusTypeReader */ struct DBusTypeWriter { + DBusString *type_str; /**< where to write typecodes (or read type expectations) */ + DBusString *value_str; /**< where to write values */ dbus_uint32_t byte_order : 8; /**< byte order to write values with */ dbus_uint32_t container_type : 8; /**< what are we inside? (e.g. struct, variant, array) */ @@ -71,9 +74,7 @@ struct DBusTypeWriter dbus_uint32_t enabled : 1; /**< whether to write values */ - DBusString *type_str; /**< where to write typecodes (or read type expectations) */ int type_pos; /**< current pos in type_str */ - DBusString *value_str; /**< where to write values */ int value_pos; /**< next position to write */ union