diff options
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/gnunet_common.h | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/src/include/gnunet_common.h b/src/include/gnunet_common.h index 4472d3ee8..9bcd99c7b 100644 --- a/src/include/gnunet_common.h +++ b/src/include/gnunet_common.h | |||
@@ -623,6 +623,31 @@ GNUNET_abort_ (void) GNUNET_NORETURN; | |||
623 | 623 | ||
624 | 624 | ||
625 | /** | 625 | /** |
626 | * Convert a buffer to an 8-character string | ||
627 | * representative of the contents. This is used | ||
628 | * for logging binary data when debugging. | ||
629 | * | ||
630 | * @param buf buffer to log | ||
631 | * @param buf_size number of bytes in @a buf | ||
632 | * @return text representation of buf, valid until next | ||
633 | * call to this function | ||
634 | */ | ||
635 | const char * | ||
636 | GNUNET_b2s (const void *buf, | ||
637 | size_t buf_size); | ||
638 | |||
639 | |||
640 | /** | ||
641 | * Convert a fixed-sized object to a string using | ||
642 | * #GNUNET_b2s(). | ||
643 | * | ||
644 | * @param obj address of object to convert | ||
645 | * @return string representing the binary obj buffer | ||
646 | */ | ||
647 | #define GNUNET_B2S(obj) GNUNET_b2s ((obj), sizeof (*(obj))) | ||
648 | |||
649 | |||
650 | /** | ||
626 | * @ingroup logging | 651 | * @ingroup logging |
627 | * Ignore the next @a n calls to the log function. | 652 | * Ignore the next @a n calls to the log function. |
628 | * | 653 | * |
@@ -1240,7 +1265,7 @@ GNUNET_is_zero_ (const void *a, | |||
1240 | * @return GNUNET_YES if a is zero, GNUNET_NO otherwise | 1265 | * @return GNUNET_YES if a is zero, GNUNET_NO otherwise |
1241 | */ | 1266 | */ |
1242 | #define GNUNET_is_zero(a) \ | 1267 | #define GNUNET_is_zero(a) \ |
1243 | GNUNET_is_zero_ (a, sizeof (*a)) | 1268 | GNUNET_is_zero_ ((a), sizeof (*(a))) |
1244 | 1269 | ||
1245 | 1270 | ||
1246 | /** | 1271 | /** |