--- libaitio/inc/aitio.h 2012/05/15 13:15:43 1.17.4.1 +++ libaitio/inc/aitio.h 2012/05/15 13:39:08 1.17.4.2 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: aitio.h,v 1.17.4.1 2012/05/15 13:15:43 misho Exp $ +* $Id: aitio.h,v 1.17.4.2 2012/05/15 13:39:08 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -153,6 +153,17 @@ typedef struct { #define AIT_SET_PTR(_vl, _p, _len) do { ait_val_t *__val = (_vl); assert(__val); \ __val->val_type = ptr; AIT_LEN(__val) = _len; \ __val->val.ptr = _p; } while (0) +#define AIT_RE_BUF(_vl, _len) do { ait_val_t *__val = (_vl); assert(__val); \ + void *__ptr = realloc(AIT_GET_BUF(__val), _len); \ + if (__ptr) { \ + __val->val.buffer = __ptr; AIT_LEN(__val) = _len; \ + } } while (0) +#define AIT_SET_BUF2(_vl, _c, _len) do { ait_val_t *__val = (_vl); assert(__val); \ + __val->val.buffer = malloc(_len); \ + if (__val->val.buffer) { \ + __val->val_type = buffer; AIT_LEN(__val) = _len; \ + memset(__val->val.buffer, _c, _len); \ + } } while (0) #define AIT_SET_BUF(_vl, _v, _len) do { ait_val_t *__val = (_vl); assert(__val); \ __val->val.buffer = malloc(_len); \ if (__val->val.buffer) { \