--- libaitio/inc/aitio.h 2012/05/14 12:49:21 1.17 +++ libaitio/inc/aitio.h 2012/05/15 13:15:43 1.17.4.1 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: aitio.h,v 1.17 2012/05/14 12:49:21 misho Exp $ +* $Id: aitio.h,v 1.17.4.1 2012/05/15 13:15:43 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -157,9 +157,12 @@ typedef struct { __val->val.buffer = malloc(_len); \ if (__val->val.buffer) { \ __val->val_type = buffer; AIT_LEN(__val) = _len; \ - memcpy(__val->val.buffer, (_v), _len); \ + if ((_v)) \ + memcpy(__val->val.buffer, (_v), _len); \ + else \ + memset(__val->val.buffer, 0, _len); \ } } while (0) -#define AIT_SET_STR(_vl, _v) do { ait_val_t *__val = (_vl); assert(__val); \ +#define AIT_SET_STR(_vl, _v) do { ait_val_t *__val = (_vl); assert(__val && (_v)); \ __val->val.string = (int8_t*) strdup((_v)); \ if (__val->val.string) { \ __val->val_type = string; \