]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
alignof: handle sizeof(t) == 1 case
authorVincent Bernat <bernat@luffy.cx>
Sat, 23 Nov 2013 08:30:35 +0000 (09:30 +0100)
committerVincent Bernat <bernat@luffy.cx>
Sat, 23 Nov 2013 08:30:35 +0000 (09:30 +0100)
src/marshal.c

index 886600900136743451445ad49d4f48c4faeb8b4d..45c46cbcae004a5a109cdf5a14b9e1b2df2131b4 100644 (file)
@@ -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 {