More W32 resolver workarounds
[oweals/gnunet.git] / src / include / gnunet_common.h
index e593826b78eff316a704cbc7ad649b28508c2e87..e4423f145729fbf50623801abffa8edf263b6207 100644 (file)
@@ -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.