aboutsummaryrefslogtreecommitdiff
path: root/src/util/common_logging.c
diff options
context:
space:
mode:
authorlurchi <lurchi@strangeplace.net>2017-07-08 21:50:20 +0200
committerlurchi <lurchi@strangeplace.net>2017-07-08 21:50:20 +0200
commitcdf3b6745f83502a6fd246cb92a225f09bc4de0d (patch)
treefdba8822742e7fc453a3bef42a136f1ed4f1eaa7 /src/util/common_logging.c
parent4e2fafb606f98f71aa404b9d0a55bc3b39f90418 (diff)
downloadgnunet-cdf3b6745f83502a6fd246cb92a225f09bc4de0d.tar.gz
gnunet-cdf3b6745f83502a6fd246cb92a225f09bc4de0d.zip
implement GNUNET_h2s2 for printing two hashes in one log output line
Diffstat (limited to 'src/util/common_logging.c')
-rw-r--r--src/util/common_logging.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/util/common_logging.c b/src/util/common_logging.c
index 34481fe13..33edb9b1a 100644
--- a/src/util/common_logging.c
+++ b/src/util/common_logging.c
@@ -1156,6 +1156,27 @@ GNUNET_h2s (const struct GNUNET_HashCode * hc)
1156 1156
1157 1157
1158/** 1158/**
1159 * Convert a hash to a string (for printing debug messages).
1160 * This is one of the very few calls in the entire API that is
1161 * NOT reentrant! Identical to #GNUNET_h2s(), except that another
1162 * buffer is used so both #GNUNET_h2s() and #GNUNET_i2s2() can be
1163 * used within the same log statement.
1164 *
1165 * @param hc the hash code
1166 * @return string form; will be overwritten by next call to GNUNET_h2s.
1167 */
1168const char *
1169GNUNET_h2s2 (const struct GNUNET_HashCode * hc)
1170{
1171 static struct GNUNET_CRYPTO_HashAsciiEncoded ret;
1172
1173 GNUNET_CRYPTO_hash_to_enc (hc, &ret);
1174 ret.encoding[8] = '\0';
1175 return (const char *) ret.encoding;
1176}
1177
1178
1179/**
1159 * @ingroup logging 1180 * @ingroup logging
1160 * Convert a short hash value to a string (for printing debug messages). 1181 * Convert a short hash value to a string (for printing debug messages).
1161 * This is one of the very few calls in the entire API that is 1182 * This is one of the very few calls in the entire API that is