--- libelwix/inc/elwix/aarray.h 2014/01/29 14:16:53 1.5 +++ libelwix/inc/elwix/aarray.h 2018/05/28 22:55:12 1.6.30.1 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: aarray.h,v 1.5 2014/01/29 14:16:53 misho Exp $ +* $Id: aarray.h,v 1.6.30.1 2018/05/28 22:55:12 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 - 2014 +Copyright 2004 - 2018 by Michael Pounov . All rights reserved. Redistribution and use in source and binary forms, with or without @@ -60,18 +60,17 @@ typedef struct _tagArray { #define array_Ptr(_arr, _d) ((_arr) ? (_arr)->arr_data[_d] : NULL) #define array_Get2(_arr, _d) (assert((_arr) && (_arr)->arr_num > _d), ((_arr)->arr_data + _d)) -#define array_Get(_arr, _d) (assert((_arr) && (_arr)->arr_num > _d), (_arr)->arr_data[_d]) -#define array(_arr, _d, _type) (assert((_arr) && (_arr)->arr_num > _d), \ - ((_type) (_arr)->arr_data[_d])) -#define array_Set(_arr, _d, _ptr) do { assert((_arr) && (_arr)->arr_num > _d); \ - if ((_arr)->arr_last < _d) \ - (_arr)->arr_last = _d; \ - (_arr)->arr_data[_d] = (void*) (_ptr); \ +#define array_Get(_arr, _d) (assert((_arr)), (_arr)->arr_data[_d]) +#define array(_arr, _d, _type) (assert((_arr)), ((_type) (_arr)->arr_data[_d])) +#define array_Set(_arr, _d, _ptr) do { int __d = _d; assert((_arr) && (_arr)->arr_num > __d); \ + if ((_arr)->arr_last < __d) \ + (_arr)->arr_last = __d; \ + (_arr)->arr_data[__d] = (void*) (_ptr); \ } while (0) -#define array_Del(_arr, _d, _fri) do { assert((_arr) && (_arr)->arr_num > _d); \ - if (_fri && (_arr)->arr_data[_d]) \ - e_free((_arr)->arr_data[_d]); \ - (_arr)->arr_data[_d] = NULL; \ +#define array_Del(_arr, _d, _fri) do { int __d = _d; assert((_arr) && (_arr)->arr_num > __d); \ + if (_fri && (_arr)->arr_data[__d]) \ + e_free((_arr)->arr_data[__d]); \ + (_arr)->arr_data[__d] = NULL; \ } while (0) /*