/**
* Version of the API (for entire gnunetutil.so library).
*/
-#define GNUNET_UTIL_VERSION 0x000A0101
+#define GNUNET_UTIL_VERSION 0x000A0102
/**
void *logger_cls);
+/**
+ * @ingroup logging
+ * Convert a short hash value to a string (for printing debug messages).
+ * This is one of the very few calls in the entire API that is
+ * NOT reentrant!
+ *
+ * @param shc the hash code
+ * @return string
+ */
+const char *
+GNUNET_sh2s (const struct GNUNET_ShortHashCode *shc);
+
+
/**
* @ingroup logging
* Convert a hash value to a string (for printing debug messages).
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).
#define GNUNET_assert_at(cond, f, l) do { if (! (cond)) { GNUNET_log(GNUNET_ERROR_TYPE_ERROR, _("Assertion failed at %s:%d.\n"), f, l); GNUNET_abort_(); } } while(0)
+/**
+ * @ingroup logging
+ * Use this for fatal errors that cannot be handled
+ *
+ * @param cond Condition to evaluate
+ * @param comp Component string to use for logging
+ */
+#define GNUNET_assert_from(cond, comp) do { if (! (cond)) { GNUNET_log_from(GNUNET_ERROR_TYPE_ERROR, comp, _("Assertion failed at %s:%d.\n"), __FILE__, __LINE__); GNUNET_abort_(); } } while(0)
+
+
/**
* @ingroup logging
* Use this for internal assertion violations that are
* @param m size of the second dimension
* @param type name of the struct or union, i.e. pass 'struct Foo'.
*/
-#define GNUNET_new_array_2d(n, m, type) (type **) GNUNET_xnew_array_2d_ (n, m, sizeof (type))
+#define GNUNET_new_array_2d(n, m, type) (type **) GNUNET_xnew_array_2d_ (n, m, sizeof (type), __FILE__, __LINE__)
/**
* @ingroup memory
* @param o size of the third dimension
* @param type name of the struct or union, i.e. pass 'struct Foo'.
*/
-#define GNUNET_new_array_3d(n, m, o, type) (type ***) GNUNET_xnew_array_3d_ (n, m, o, sizeof (type))
+#define GNUNET_new_array_3d(n, m, o, type) (type ***) GNUNET_xnew_array_3d_ (n, m, o, sizeof (type), __FILE__, __LINE__)
/**
* @ingroup memory
/**
* @ingroup memory
- * Wrapper around realloc. Rellocates size bytes of memory.
+ * Wrapper around realloc. Reallocates size bytes of memory.
+ * The content of the intersection of the new and old size will be unchanged.
*
* @param ptr the pointer to reallocate
* @param size the number of bytes to reallocate
* @param n size of the first dimension
* @param m size of the second dimension
* @param elementSize size of a single element in bytes
+ * @param filename where is this call being made (for debugging)
+ * @param linenumber line where this call is being made (for debugging)
* @return allocated memory, never NULL
*/
void **
-GNUNET_xnew_array_2d_ (size_t n, size_t m, size_t elementSize);
+GNUNET_xnew_array_2d_ (size_t n, size_t m, size_t elementSize,
+ const char *filename, int linenumber);
/**
* @param m size of the second dimension
* @param o size of the third dimension
* @param elementSize size of a single element in bytes
+ * @param filename where is this call being made (for debugging)
+ * @param linenumber line where this call is being made (for debugging)
* @return allocated memory, never NULL
*/
void ***
-GNUNET_xnew_array_3d_ (size_t n, size_t m, size_t o, size_t elementSize);
+GNUNET_xnew_array_3d_ (size_t n, size_t m, size_t o, size_t elementSize,
+ const char *filename, int linenumber);
/**