summaryrefslogtreecommitdiffstats
path: root/src/util/ralloc.h
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2016-10-07 02:16:12 +0200
committerMarek Olšák <[email protected]>2016-10-31 11:53:38 +0100
commit9454f7c0ef55a9357473e451f0f59432c9438f01 (patch)
treea49a2dc42cea4a9572ae88c2fd67bab65a69c27a /src/util/ralloc.h
parent3bf6c6c3adb8e5dc2488fda93aa7dde3ca256b34 (diff)
ralloc: add DECLARE_RZALLOC_CXX_OPERATORS
Reviewed-by: Edward O'Callaghan <[email protected]> Tested-by: Edmondo Tommasina <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/util/ralloc.h')
-rw-r--r--src/util/ralloc.h9
1 files changed, 7 insertions, 2 deletions
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