From: Vincent Bernat Date: Sat, 23 Nov 2013 08:30:35 +0000 (+0100) Subject: alignof: handle sizeof(t) == 1 case X-Git-Tag: 0.7.8~67 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6f4b6d5872c320343b52ae1cf1ff6d55a7fb05e5;p=thirdparty%2Flldpd.git alignof: handle sizeof(t) == 1 case --- diff --git a/src/marshal.c b/src/marshal.c index 88660090..45c46cbc 100644 --- a/src/marshal.c +++ b/src/marshal.c @@ -31,7 +31,7 @@ #include "lldpd-structs.h" /* Stolen from CCAN */ -#define ALIGNOF(t) ((char *)(&((struct { char c; t _h; } *)0)->_h) - (char *)0) +#define ALIGNOF(t) ((sizeof(t) > 1)?((char *)(&((struct { char c; t _h; } *)0)->_h) - (char *)0):1) /* A serialized object */ struct marshal_serialized {