diff options
author | lurchi <lurchi@strangeplace.net> | 2018-06-29 00:04:25 +0200 |
---|---|---|
committer | lurchi <lurchi@strangeplace.net> | 2018-06-29 00:04:25 +0200 |
commit | 7c04b23c8c80e06257706facf74a92bfec7a9914 (patch) | |
tree | eb684e84ae52badb88d1235038c5a37818075e0a /src/include/gnunet_common.h | |
parent | 2bd272b4e4f779ca0a1dd4b52bb710be5c68a7bd (diff) | |
download | gnunet-7c04b23c8c80e06257706facf74a92bfec7a9914.tar.gz gnunet-7c04b23c8c80e06257706facf74a92bfec7a9914.zip |
Allow dereferenced pointers as input for GNUNET_array_grow and GNUNET_xgrow
This is now possible:
char ***server_addrs = NULL
unsigned int len = 0
GNUNET_array_append (*server_addrs, len, "8.8.8.8");
Diffstat (limited to 'src/include/gnunet_common.h')
-rw-r--r-- | src/include/gnunet_common.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/include/gnunet_common.h b/src/include/gnunet_common.h index b4bf5b0aa..1b982cc15 100644 --- a/src/include/gnunet_common.h +++ b/src/include/gnunet_common.h | |||
@@ -1074,7 +1074,7 @@ GNUNET_ntoh_double (double d); | |||
1074 | * @param tsize the target size for the resulting vector, use 0 to | 1074 | * @param tsize the target size for the resulting vector, use 0 to |
1075 | * free the vector (then, arr will be NULL afterwards). | 1075 | * free the vector (then, arr will be NULL afterwards). |
1076 | */ | 1076 | */ |
1077 | #define GNUNET_array_grow(arr,size,tsize) GNUNET_xgrow_((void**)&arr, sizeof(arr[0]), &size, tsize, __FILE__, __LINE__) | 1077 | #define GNUNET_array_grow(arr,size,tsize) GNUNET_xgrow_((void**)&(arr), sizeof((arr)[0]), &size, tsize, __FILE__, __LINE__) |
1078 | 1078 | ||
1079 | /** | 1079 | /** |
1080 | * @ingroup memory | 1080 | * @ingroup memory |
@@ -1089,7 +1089,7 @@ GNUNET_ntoh_double (double d); | |||
1089 | * array size | 1089 | * array size |
1090 | * @param element the element that will be appended to the array | 1090 | * @param element the element that will be appended to the array |
1091 | */ | 1091 | */ |
1092 | #define GNUNET_array_append(arr,size,element) do { GNUNET_array_grow(arr,size,size+1); arr[size-1] = element; } while(0) | 1092 | #define GNUNET_array_append(arr,size,element) do { GNUNET_array_grow(arr,size,size+1); (arr)[size-1] = element; } while(0) |
1093 | 1093 | ||
1094 | /** | 1094 | /** |
1095 | * @ingroup memory | 1095 | * @ingroup memory |