diff options
author | Florian Dold <florian.dold@gmail.com> | 2019-05-09 16:23:43 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2019-05-09 16:23:43 +0200 |
commit | c24f0efcaecffb820122c6634f708942fae305cc (patch) | |
tree | 541f20612514cddebbcb462ef77142ff0d8ce665 /src/util | |
parent | 67c3314628930be7e6a9d224456c8dac0f4c8fd4 (diff) | |
download | gnunet-c24f0efcaecffb820122c6634f708942fae305cc.tar.gz gnunet-c24f0efcaecffb820122c6634f708942fae305cc.zip |
make logging more re-entrant
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/common_logging.c | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/src/util/common_logging.c b/src/util/common_logging.c index 34002e0fc..77a595878 100644 --- a/src/util/common_logging.c +++ b/src/util/common_logging.c | |||
@@ -1168,8 +1168,6 @@ GNUNET_error_type_to_string (enum GNUNET_ErrorType kind) | |||
1168 | 1168 | ||
1169 | /** | 1169 | /** |
1170 | * Convert a hash to a string (for printing debug messages). | 1170 | * Convert a hash to a string (for printing debug messages). |
1171 | * This is one of the very few calls in the entire API that is | ||
1172 | * NOT reentrant! | ||
1173 | * | 1171 | * |
1174 | * @param hc the hash code | 1172 | * @param hc the hash code |
1175 | * @return string form; will be overwritten by next call to GNUNET_h2s. | 1173 | * @return string form; will be overwritten by next call to GNUNET_h2s. |
@@ -1177,7 +1175,7 @@ GNUNET_error_type_to_string (enum GNUNET_ErrorType kind) | |||
1177 | const char * | 1175 | const char * |
1178 | GNUNET_h2s (const struct GNUNET_HashCode * hc) | 1176 | GNUNET_h2s (const struct GNUNET_HashCode * hc) |
1179 | { | 1177 | { |
1180 | static struct GNUNET_CRYPTO_HashAsciiEncoded ret; | 1178 | static GNUNET_THREAD_LOCAL struct GNUNET_CRYPTO_HashAsciiEncoded ret; |
1181 | 1179 | ||
1182 | GNUNET_CRYPTO_hash_to_enc (hc, &ret); | 1180 | GNUNET_CRYPTO_hash_to_enc (hc, &ret); |
1183 | ret.encoding[8] = '\0'; | 1181 | ret.encoding[8] = '\0'; |
@@ -1350,8 +1348,6 @@ GNUNET_h2s_full (const struct GNUNET_HashCode * hc) | |||
1350 | 1348 | ||
1351 | /** | 1349 | /** |
1352 | * Convert a peer identity to a string (for printing debug messages). | 1350 | * Convert a peer identity to a string (for printing debug messages). |
1353 | * This is one of the very few calls in the entire API that is | ||
1354 | * NOT reentrant! | ||
1355 | * | 1351 | * |
1356 | * @param pid the peer identity | 1352 | * @param pid the peer identity |
1357 | * @return string form of the pid; will be overwritten by next | 1353 | * @return string form of the pid; will be overwritten by next |
@@ -1360,7 +1356,7 @@ GNUNET_h2s_full (const struct GNUNET_HashCode * hc) | |||
1360 | const char * | 1356 | const char * |
1361 | GNUNET_i2s (const struct GNUNET_PeerIdentity *pid) | 1357 | GNUNET_i2s (const struct GNUNET_PeerIdentity *pid) |
1362 | { | 1358 | { |
1363 | static char buf[5]; | 1359 | static GNUNET_THREAD_LOCAL char buf[5]; |
1364 | char *ret; | 1360 | char *ret; |
1365 | 1361 | ||
1366 | if (NULL == pid) | 1362 | if (NULL == pid) |
@@ -1377,8 +1373,7 @@ GNUNET_i2s (const struct GNUNET_PeerIdentity *pid) | |||
1377 | 1373 | ||
1378 | /** | 1374 | /** |
1379 | * Convert a peer identity to a string (for printing debug messages). | 1375 | * Convert a peer identity to a string (for printing debug messages). |
1380 | * This is one of the very few calls in the entire API that is | 1376 | * Identical to #GNUNET_i2s(), except that another |
1381 | * NOT reentrant! Identical to #GNUNET_i2s(), except that another | ||
1382 | * buffer is used so both #GNUNET_i2s() and #GNUNET_i2s2() can be | 1377 | * buffer is used so both #GNUNET_i2s() and #GNUNET_i2s2() can be |
1383 | * used within the same log statement. | 1378 | * used within the same log statement. |
1384 | * | 1379 | * |
@@ -1389,7 +1384,7 @@ GNUNET_i2s (const struct GNUNET_PeerIdentity *pid) | |||
1389 | const char * | 1384 | const char * |
1390 | GNUNET_i2s2 (const struct GNUNET_PeerIdentity *pid) | 1385 | GNUNET_i2s2 (const struct GNUNET_PeerIdentity *pid) |
1391 | { | 1386 | { |
1392 | static char buf[5]; | 1387 | static GNUNET_THREAD_LOCAL char buf[5]; |
1393 | char *ret; | 1388 | char *ret; |
1394 | 1389 | ||
1395 | if (NULL == pid) | 1390 | if (NULL == pid) |
@@ -1406,8 +1401,6 @@ GNUNET_i2s2 (const struct GNUNET_PeerIdentity *pid) | |||
1406 | 1401 | ||
1407 | /** | 1402 | /** |
1408 | * Convert a peer identity to a string (for printing debug messages). | 1403 | * Convert a peer identity to a string (for printing debug messages). |
1409 | * This is one of the very few calls in the entire API that is | ||
1410 | * NOT reentrant! | ||
1411 | * | 1404 | * |
1412 | * @param pid the peer identity | 1405 | * @param pid the peer identity |
1413 | * @return string form of the pid; will be overwritten by next | 1406 | * @return string form of the pid; will be overwritten by next |
@@ -1416,7 +1409,7 @@ GNUNET_i2s2 (const struct GNUNET_PeerIdentity *pid) | |||
1416 | const char * | 1409 | const char * |
1417 | GNUNET_i2s_full (const struct GNUNET_PeerIdentity *pid) | 1410 | GNUNET_i2s_full (const struct GNUNET_PeerIdentity *pid) |
1418 | { | 1411 | { |
1419 | static char buf[256]; | 1412 | static GNUNET_THREAD_LOCAL char buf[256]; |
1420 | char *ret; | 1413 | char *ret; |
1421 | 1414 | ||
1422 | ret = GNUNET_CRYPTO_eddsa_public_key_to_string (&pid->public_key); | 1415 | ret = GNUNET_CRYPTO_eddsa_public_key_to_string (&pid->public_key); |