]> mj.ucw.cz Git - libucw.git/commitdiff
LibUCW: Fixed broken DARY_ALLOC() on 64bit architectures.
authorPavel Charvat <pchar@ucw.cz>
Thu, 24 Oct 2013 13:47:49 +0000 (15:47 +0200)
committerPavel Charvat <pchar@ucw.cz>
Thu, 24 Oct 2013 13:47:49 +0000 (15:47 +0200)
ucw/conf.h

index 0ff991309f146bfb1505c77ed7fa9a2d23219239..d08aa12098db6079d269b37213f7dc4994418ce4 100644 (file)
@@ -392,7 +392,7 @@ struct cf_section {                 /** A section. **/
 #define CF_ANY_NUM             -0x7fffffff
 
 #define DARY_LEN(a) ((uns*)a)[-1]      /** Length of an dynamic array. **/
-#define DARY_ALLOC(type,len,val...) ((struct { uns l; type a[len]; }) { .l = len, .a = { val } }).a
+#define DARY_ALLOC(type,len,val...) ((struct { byte pad[ALIGN_TO(sizeof(uns), CPU_STRUCT_ALIGN) - sizeof(uns)]; uns l; type a[len]; }) { .l = len, .a = { val } }).a
   // creates a static instance of a dynamic array
 
 /***