mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
macros should not contain multiple statements!
This commit is contained in:
parent
d8447664dd
commit
4d6f85c151
2 changed files with 4 additions and 9 deletions
|
@ -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, \
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue