diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/util/common_logging.c | 21 |
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 | */ | ||
1168 | const char * | ||
1169 | GNUNET_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 |