-removing 2nd argument from GNUNET_CLIENT_disconnect as it was virtually always GNUNE...
[oweals/gnunet.git] / src / util / common_logging.c
index 72a2c67dae4196d4d273c9b574cdf69a14f8397c..e19aa8c7cd3303e765f6738e0908e8188969aeed 100644 (file)
@@ -429,7 +429,6 @@ parse_definitions (const char *constname, int force)
   if (tmp == NULL)
     return 0;
   def = GNUNET_strdup (tmp);
-  level = -1;
   from_line = 0;
   to_line = INT_MAX;
   for (p = def, state = 0, start = def; keep_looking; p++)
@@ -457,7 +456,7 @@ parse_definitions (const char *constname, int force)
           from_line = strtol (start, &t, 10);
           if (errno != 0 || from_line < 0)
           {
-            free (def);
+            GNUNET_free (def);
             return counter;
           }
           if (t < p && t[0] == '-')
@@ -467,7 +466,7 @@ parse_definitions (const char *constname, int force)
             to_line = strtol (start, &t, 10);
             if (errno != 0 || to_line < 0 || t != p)
             {
-              free (def);
+              GNUNET_free (def);
               return counter;
             }
           }
@@ -499,7 +498,7 @@ parse_definitions (const char *constname, int force)
             0 != add_definition (comp, file, function, from_line, to_line,
                                  level, force))
         {
-          free (def);
+          GNUNET_free (def);
           return counter;
         }
         counter += 1;
@@ -512,7 +511,7 @@ parse_definitions (const char *constname, int force)
       break;
     }
   }
-  free (def);
+  GNUNET_free (def);
   return counter;
 }
 
@@ -949,6 +948,23 @@ GNUNET_i2s (const struct GNUNET_PeerIdentity *pid)
   return (const char *) ret.encoding;
 }
 
+/**
+ * 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
+ * @return string form of the pid; will be overwritten by next
+ *         call to GNUNET_i2s.
+ */
+const char *
+GNUNET_i2s_full (const struct GNUNET_PeerIdentity *pid)
+{
+  static struct GNUNET_CRYPTO_HashAsciiEncoded ret;
+
+  GNUNET_CRYPTO_hash_to_enc (&pid->hashPubKey, &ret);
+  return (const char *) ret.encoding;
+}
 
 
 /**