Use GNU struct pack/align attribute

This commit is contained in:
XANTRONIX Development 2024-10-13 22:47:57 -04:00
parent 22e1f5b3e8
commit 05ee17a9fc
2 changed files with 7 additions and 16 deletions

View file

@ -38,16 +38,11 @@ enum patty_ax25_proto {
PATTY_AX25_PROTO_ESCAPE = 0xff
};
#pragma pack(push)
#pragma pack(1)
typedef struct _patty_ax25_addr {
char callsign[PATTY_AX25_CALLSTRLEN];
uint8_t ssid;
char callsign[PATTY_AX25_CALLSTRLEN] __attribute__((packed, aligned(1)));
uint8_t ssid __attribute__((packed, aligned(1)));
} patty_ax25_addr;
#pragma pack(pop)
enum patty_ax25_param_type {
PATTY_AX25_PARAM_CLASSES = 2,
PATTY_AX25_PARAM_HDLC = 3,

View file

@ -89,22 +89,18 @@ enum patty_ax25_frame_xid_group_type {
PATTY_AX25_FRAME_XID_GROUP_PARAMS = 0x80
};
#pragma pack(push)
#pragma pack(1)
typedef struct _patty_ax25_frame_xid_group {
uint8_t format,
type;
uint8_t format __attribute__((packed, aligned(1))),
type __attribute__((packed, aligned(1)));
uint16_t len;
uint16_t len __attribute__((packed, aligned(1)));
} patty_ax25_frame_xid_group;
typedef struct _patty_ax25_frame_xid_param {
uint8_t id, len;
uint8_t id __attribute__((packed, aligned(1))),
len __attribute__((packed, aligned(1)));
} patty_ax25_frame_xid_param;
#pragma pack(pop)
ssize_t patty_ax25_frame_decode_address(patty_ax25_frame *frame,
const void *buf,
size_t len);