void *tail_memdup(const void *, const size_t)
ATTRIBUTE_MALLOC ATTRIBUTE_ALLOC_SIZE((2));
+/*
+ * Allocate an object of the specified type at the end
+ * of a mapped memory region.
+ * Assign its address to the specified constant pointer.
+ */
+#define TAIL_ALLOC_OBJECT_CONST_PTR(type_name, type_ptr) \
+ type_name *const type_ptr = tail_alloc(sizeof(*type_ptr))
+
+/*
+ * Allocate an object of the specified type at the end
+ * of a mapped memory region.
+ * Assign its address to the specified variable pointer.
+ */
+#define TAIL_ALLOC_OBJECT_VAR_PTR(type_name, type_ptr) \
+ type_name *type_ptr = tail_alloc(sizeof(*type_ptr))
+
/*
* Fill memory (pointed by ptr, having size bytes) with different bytes (with
* values starting with start and resetting every period) in order to catch