diff options
Diffstat (limited to 'src/runtime/c/gu/mem.h')
| -rw-r--r-- | src/runtime/c/gu/mem.h | 50 |
1 files changed, 0 insertions, 50 deletions
diff --git a/src/runtime/c/gu/mem.h b/src/runtime/c/gu/mem.h index e389bcc0c..e52e14968 100644 --- a/src/runtime/c/gu/mem.h +++ b/src/runtime/c/gu/mem.h @@ -112,24 +112,6 @@ gu_malloc(GuPool* pool, size_t size) { #include <string.h> -//@private -static inline void* -gu_malloc_init_aligned(GuPool* pool, size_t size, size_t alignment, - const void* init) -{ - void* p = gu_malloc_aligned(pool, size, alignment); - memcpy(p, init, size); - return p; -} - -//@private -static inline void* -gu_malloc_init(GuPool* pool, size_t size, const void* init) -{ - return gu_malloc_init_aligned(pool, size, 0, init); -} - - /** Allocate memory to store an array of objects of a given type. */ #define gu_new_n(type, n, pool) \ @@ -167,38 +149,6 @@ gu_malloc_init(GuPool* pool, size_t size, const void* init) gu_alignof(pre_type), sizeof(pre_type), \ gu_alignof(type), sizeof(type)))) - - - - -#ifdef HAVE_STATEMENT_EXPRESSIONS -#define gu_new_i(pool, type, ...) \ - ({ \ - type *gu_new_p_ = gu_new(type, pool); \ - memcpy((void*) gu_new_p_, &(type){ __VA_ARGS__ }, \ - sizeof(type)); \ - gu_new_p_; \ - }) -#else // HAVE_STATEMENT_EXPRESSIONS -#define gu_new_i(pool, type, ...) \ - ((type*)gu_malloc_init_aligned((pool), sizeof(type), \ - gu_alignof(type), \ - &(type){ __VA_ARGS__ })) -#endif // HAVE_STATEMENT_EXPRESSIONS - -/** @def gu_new_i(pool, type, ...) - * - * Allocate and initialize an object. - * - * @param pool The pool to allocate from. - * - * @param type The C type of the object to allocate. - * - * @param ... An initializer list for the object to allocate. - */ - -#define gu_new_s gu_new_i - // Alas, there's no portable way to get the alignment of flex structs. #define gu_new_flex(pool_, type_, flex_member_, n_elems_) \ ((type_ *)gu_malloc_aligned( \ |
