gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [gnunet] 07/19: introcude GNUNET_i2s2()


From: gnunet
Subject: [GNUnet-SVN] [gnunet] 07/19: introcude GNUNET_i2s2()
Date: Sun, 22 Jan 2017 15:23:48 +0100

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository gnunet.

commit 02132e8fc311b966154fd5d9f0b3686ea8c2bf86
Author: Christian Grothoff <address@hidden>
AuthorDate: Sun Jan 22 12:21:24 2017 +0100

    introcude GNUNET_i2s2()
---
 src/include/gnunet_common.h | 16 ++++++++++++++++
 src/util/common_logging.c   | 25 +++++++++++++++++++++++++
 2 files changed, 41 insertions(+)

diff --git a/src/include/gnunet_common.h b/src/include/gnunet_common.h
index 9ad604711..fdcae66fa 100644
--- a/src/include/gnunet_common.h
+++ b/src/include/gnunet_common.h
@@ -614,6 +614,22 @@ GNUNET_i2s (const struct GNUNET_PeerIdentity *pid);
  * @ingroup logging
  * Convert a peer identity to a string (for printing debug messages).
  * This is one of the very few calls in the entire API that is
+ * NOT reentrant!  Identical to #GNUNET_i2s(), except that another
+ * buffer is used so both #GNUNET_i2s() and #GNUNET_i2s2() can be
+ * used within the same log statement.
+ *
+ * @param pid the peer identity
+ * @return string form of the pid; will be overwritten by next
+ *         call to #GNUNET_i2s().
+ */
+const char *
+GNUNET_i2s2 (const struct GNUNET_PeerIdentity *pid);
+
+
+/**
+ * @ingroup logging
+ * Convert a peer identity to a string (for printing debug messages).
+ * This is one of the very few calls in the entire API that is
  * NOT reentrant!
  *
  * @param pid the peer identity
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)
 /**
  * Convert a peer identity to a string (for printing debug messages).
  * This is one of the very few calls in the entire API that is
+ * NOT reentrant!  Identical to #GNUNET_i2s(), except that another
+ * buffer is used so both #GNUNET_i2s() and #GNUNET_i2s2() can be
+ * used within the same log statement.
+ *
+ * @param pid the peer identity
+ * @return string form of the pid; will be overwritten by next
+ *         call to #GNUNET_i2s.
+ */
+const char *
+GNUNET_i2s2 (const struct GNUNET_PeerIdentity *pid)
+{
+  static char buf[256];
+  char *ret;
+
+  ret = GNUNET_CRYPTO_eddsa_public_key_to_string (&pid->public_key);
+  strcpy (buf, ret);
+  GNUNET_free (ret);
+  buf[4] = '\0';
+  return buf;
+}
+
+
+/**
+ * Convert a peer identity to a string (for printing debug messages).
+ * This is one of the very few calls in the entire API that is
  * NOT reentrant!
  *
  * @param pid the peer identity

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]