diff options
author | Christian Grothoff <christian@grothoff.org> | 2017-01-22 12:21:24 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2017-01-22 12:21:24 +0100 |
commit | 02132e8fc311b966154fd5d9f0b3686ea8c2bf86 (patch) | |
tree | 2917a9efadd6c66432b21c88131691c0ca38424a /src/util/common_logging.c | |
parent | 0e6da3245dec82dd5f3a0f1cd3f3505bf454422d (diff) | |
download | gnunet-02132e8fc311b966154fd5d9f0b3686ea8c2bf86.tar.gz gnunet-02132e8fc311b966154fd5d9f0b3686ea8c2bf86.zip |
introcude GNUNET_i2s2()
Diffstat (limited to 'src/util/common_logging.c')
-rw-r--r-- | src/util/common_logging.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/util/common_logging.c b/src/util/common_logging.c index ce229826e..dad5d3776 100644 --- a/src/util/common_logging.c +++ b/src/util/common_logging.c | |||
@@ -1220,6 +1220,31 @@ GNUNET_i2s (const struct GNUNET_PeerIdentity *pid) | |||
1220 | /** | 1220 | /** |
1221 | * Convert a peer identity to a string (for printing debug messages). | 1221 | * Convert a peer identity to a string (for printing debug messages). |
1222 | * This is one of the very few calls in the entire API that is | 1222 | * This is one of the very few calls in the entire API that is |
1223 | * NOT reentrant! Identical to #GNUNET_i2s(), except that another | ||
1224 | * buffer is used so both #GNUNET_i2s() and #GNUNET_i2s2() can be | ||
1225 | * used within the same log statement. | ||
1226 | * | ||
1227 | * @param pid the peer identity | ||
1228 | * @return string form of the pid; will be overwritten by next | ||
1229 | * call to #GNUNET_i2s. | ||
1230 | */ | ||
1231 | const char * | ||
1232 | GNUNET_i2s2 (const struct GNUNET_PeerIdentity *pid) | ||
1233 | { | ||
1234 | static char buf[256]; | ||
1235 | char *ret; | ||
1236 | |||
1237 | ret = GNUNET_CRYPTO_eddsa_public_key_to_string (&pid->public_key); | ||
1238 | strcpy (buf, ret); | ||
1239 | GNUNET_free (ret); | ||
1240 | buf[4] = '\0'; | ||
1241 | return buf; | ||
1242 | } | ||
1243 | |||
1244 | |||
1245 | /** | ||
1246 | * Convert a peer identity to a string (for printing debug messages). | ||
1247 | * This is one of the very few calls in the entire API that is | ||
1223 | * NOT reentrant! | 1248 | * NOT reentrant! |
1224 | * | 1249 | * |
1225 | * @param pid the peer identity | 1250 | * @param pid the peer identity |