--- libelwix/inc/elwix/avar.h 2015/06/25 17:53:49 1.9 +++ libelwix/inc/elwix/avar.h 2022/01/06 15:13:01 1.12 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: avar.h,v 1.9 2015/06/25 17:53:49 misho Exp $ +* $Id: avar.h,v 1.12 2022/01/06 15:13:01 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -12,7 +12,7 @@ terms: All of the documentation and software included in the ELWIX and AITNET Releases is copyrighted by ELWIX - Sofia/Bulgaria -Copyright 2004 - 2015 +Copyright 2004 - 2022 by Michael Pounov . All rights reserved. Redistribution and use in source and binary forms, with or without @@ -57,7 +57,7 @@ typedef enum { i8, i16, i32, i64, /* integers ... */ } ait_type_t; -typedef struct { +typedef struct __packed { uint8_t val_type; union { struct { @@ -93,7 +93,7 @@ typedef struct { int64_t i64; } val; uint8_t val_data[0]; -} __packed ait_val_t; /* sizeof 16 bytes */ +} /*__packed*/ ait_val_t; /* sizeof 16 bytes */ #define AIT_TYPE(_vl) ((ait_type_t) (_vl)->val_type) #define AIT_LEN(_vl) (_vl)->val_len @@ -308,6 +308,7 @@ typedef struct { break; \ } \ } while (0) +/* Additional helper macro, which can help about copy data variables */ #define AIT_COPY_DATA(_vl, _v) do { AIT_COPY_VAL((_vl), (_v)); \ if (AIT_TYPE((_vl)) == data) \ AIT_SET_DATA((_vl), AIT_GET_DATA((_v)), \ @@ -352,6 +353,7 @@ typedef struct { switch (AIT_TYPE(__val)) { \ case buffer: \ case string: \ + assert(!__val->val_in); \ if (__val->val.buffer) \ memset(__val->val.buffer, 0, \ AIT_LEN(__val)); \