-doxygen, plus FIXME request for clarification
[oweals/gnunet.git] / src / include / gnunet_common.h
index e593826b78eff316a704cbc7ad649b28508c2e87..ec077d355fe175ae40427af373952140986289c2 100644 (file)
@@ -60,7 +60,7 @@ extern "C"
 /**
  * Version of the API (for entire gnunetutil.so library).
  */
-#define GNUNET_UTIL_VERSION 0x000A0000
+#define GNUNET_UTIL_VERSION 0x000A0100
 
 /**
  * Named constants for return values.  The following invariants hold:
@@ -376,7 +376,7 @@ GNUNET_log_from_nocheck (enum GNUNET_ErrorType kind, const char *comp,
   }\
 } while (0)
 
-#define GNUNET_log(kind,...) do { int log_line = __LINE__;\
+ #define GNUNET_log(kind,...) do { int log_line = __LINE__;\
   static int log_call_enabled = GNUNET_LOG_CALL_STATUS;\
   if ((GNUNET_EXTRA_LOGGING > 0) || ((GNUNET_ERROR_TYPE_DEBUG & (kind)) == 0)) { \
     if (GN_UNLIKELY(log_call_enabled == -1))\
@@ -680,6 +680,17 @@ GNUNET_ntoh_double (double d);
  */
 #define GNUNET_new(type) (type *) GNUNET_malloc (sizeof (type))
 
+/**
+ * @ingroup memory
+ * Allocate a size @a n array with structs or unions of the given @a type.
+ * Wrapper around #GNUNET_malloc that returns a pointer
+ * to the newly created objects of the correct type.
+ *
+ * @param n number of elements in the array
+ * @param type name of the struct or union, i.e. pass 'struct Foo'.
+ */
+#define GNUNET_new_array(n, type) (type *) GNUNET_malloc ((n) * sizeof (type))
+
 /**
  * @ingroup memory
  * Wrapper around malloc. Allocates size bytes of memory.