From: Marek Olšák Date: Fri, 7 Oct 2016 00:16:12 +0000 (+0200) Subject: ralloc: add DECLARE_RZALLOC_CXX_OPERATORS X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9454f7c0ef55a9357473e451f0f59432c9438f01;p=mesa.git ralloc: add DECLARE_RZALLOC_CXX_OPERATORS Reviewed-by: Edward O'Callaghan Tested-by: Edmondo Tommasina Reviewed-by: Nicolai Hähnle Reviewed-by: Kenneth Graunke --- diff --git a/src/util/ralloc.h b/src/util/ralloc.h index 7587e1190b0..d74a39875c1 100644 --- a/src/util/ralloc.h +++ b/src/util/ralloc.h @@ -421,7 +421,7 @@ bool ralloc_vasprintf_append(char **str, const char *fmt, va_list args); * * which is more idiomatic in C++ than calling ralloc. */ -#define DECLARE_RALLOC_CXX_OPERATORS(TYPE) \ +#define DECLARE_ALLOC_CXX_OPERATORS_TEMPLATE(TYPE, ALLOC_FUNC) \ private: \ static void _ralloc_destructor(void *p) \ { \ @@ -430,7 +430,7 @@ private: \ public: \ static void* operator new(size_t size, void *mem_ctx) \ { \ - void *p = ralloc_size(mem_ctx, size); \ + void *p = ALLOC_FUNC(mem_ctx, size); \ assert(p != NULL); \ if (!HAS_TRIVIAL_DESTRUCTOR(TYPE)) \ ralloc_set_destructor(p, _ralloc_destructor); \ @@ -448,5 +448,10 @@ public: \ ralloc_free(p); \ } +#define DECLARE_RALLOC_CXX_OPERATORS(type) \ + DECLARE_ALLOC_CXX_OPERATORS_TEMPLATE(type, ralloc_size) + +#define DECLARE_RZALLOC_CXX_OPERATORS(type) \ + DECLARE_ALLOC_CXX_OPERATORS_TEMPLATE(type, rzalloc_size) #endif