From 4d6f85c151069ee12711fe50c6a4847a5ae9553d Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Wed, 10 Apr 2019 09:51:56 +0200 Subject: [PATCH] macros should not contain multiple statements! --- include/villas/formats/msg_format.h | 7 ------- lib/formats/msg.cpp | 6 ++++-- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/include/villas/formats/msg_format.h b/include/villas/formats/msg_format.h index b0f85acd7..1d7aaecc0 100644 --- a/include/villas/formats/msg_format.h +++ b/include/villas/formats/msg_format.h @@ -46,13 +46,6 @@ extern "C" { /** The offset to the first data value in a message. */ #define MSG_DATA_OFFSET(msg) ((char *) (msg) + offsetof(struct msg, data)) -/** Initialize a message with default values */ -#define MSG_INIT(len, seq, i) \ - i->type = MSG_TYPE_DATA; \ - i->version = MSG_VERSION; \ - i->length = (uint16_t) (len); \ - i->sequence = (uint32_t) (seq); - /** The timestamp of a message in struct timespec format */ #define MSG_TS(msg) (struct timespec) { \ .tv_sec = (msg)->ts.sec, \ diff --git a/lib/formats/msg.cpp b/lib/formats/msg.cpp index 7ba65561b..497a01295 100644 --- a/lib/formats/msg.cpp +++ b/lib/formats/msg.cpp @@ -108,8 +108,10 @@ int msg_to_sample(struct msg *msg, struct sample *smp, struct vlist *signals) int msg_from_sample(struct msg *msgIn, struct sample *smp, struct vlist *signals) { - MSG_INIT(smp->length, smp->sequence, msgIn); - + msgIn->type = MSG_TYPE_DATA; + msgIn->version = MSG_VERSION; + msgIn->length = (uint16_t) smp->length; + msgIn->sequence = (uint32_t) smp->sequence; msgIn->ts.sec = smp->ts.origin.tv_sec; msgIn->ts.nsec = smp->ts.origin.tv_nsec;