aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_common.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/gnunet_common.h')
-rw-r--r--src/include/gnunet_common.h18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/include/gnunet_common.h b/src/include/gnunet_common.h
index 6e185c314..6d9652a16 100644
--- a/src/include/gnunet_common.h
+++ b/src/include/gnunet_common.h
@@ -1101,15 +1101,25 @@ GNUNET_ntoh_double (double d);
1101/** 1101/**
1102 * Check that memory in @a a is all zeros. @a a must be a pointer. 1102 * Check that memory in @a a is all zeros. @a a must be a pointer.
1103 * 1103 *
1104 * @param a pointer to @a n bytes which should be tested for the
1105 * entire memory being zero'ed out.
1106 * @param n number of bytes in @a to be tested
1107 * @return 0 if a is zero, non-zero otherwise
1108 */
1109int
1110GNUNET_is_zero_ (const void *a,
1111 size_t n);
1112
1113
1114/**
1115 * Check that memory in @a a is all zeros. @a a must be a pointer.
1116 *
1104 * @param a pointer to a struct which should be tested for the 1117 * @param a pointer to a struct which should be tested for the
1105 * entire memory being zero'ed out. 1118 * entire memory being zero'ed out.
1106 * @return 0 if a is zero, non-zero otherwise 1119 * @return 0 if a is zero, non-zero otherwise
1107 */ 1120 */
1108#define GNUNET_is_zero(a) \ 1121#define GNUNET_is_zero(a) \
1109 ({ \ 1122 GNUNET_is_zero_ (a, sizeof (a))
1110 static const typeof (*a) _z; \
1111 memcmp ((a), &_z, sizeof(_z)); \
1112 })
1113 1123
1114 1124
1115/** 1125/**