Use header_sizeof() for header size instead of gcc packed attribute
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 17 May 2011 13:00:42 +0000 (09:00 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 17 May 2011 13:00:42 +0000 (09:00 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
formats/ctf/ctf.c
include/babeltrace/ctf/metadata.h

index 7c354bf0a40710a9eed836226d6bb273f94b2148..ac064b809995ea72e06e84b85821292d6351e873 100644 (file)
@@ -410,7 +410,7 @@ int ctf_open_trace_metadata_packet_read(struct ctf_trace *td, FILE *in,
        char buf[4096];
        int ret = 0;
 
-       readlen = fread(&header, sizeof(header), 1, in);
+       readlen = fread(&header, header_sizeof(header), 1, in);
        if (readlen < 1)
                return -EINVAL;
 
index c197624793f932a9a3fb4495ec648c90a1760385..e3cd325ae8aa6637b51c971541176b7f4f230a2a 100644 (file)
@@ -179,6 +179,9 @@ struct ctf_event {
        } field_mask;
 };
 
+#define HEADER_END             char end_field
+#define header_sizeof(type)    offsetof(typeof(type), end_field)
+
 struct metadata_packet_header {
        uint32_t magic;                 /* 0x75D11D57 */
        uint8_t  uuid[16];              /* Unique Universal Identifier */
@@ -188,6 +191,8 @@ struct metadata_packet_header {
        uint8_t  compression_scheme;    /* 0 if unused */
        uint8_t  encryption_scheme;     /* 0 if unused */
        uint8_t  checksum_scheme;       /* 0 if unused */
-} __attribute__((packed));
+       HEADER_END;
+};
+
 
 #endif /* _BABELTRACE_CTF_METADATA_H */
This page took 0.02504 seconds and 4 git commands to generate.