Now that the macros arrange for the destructors to be called, we can use them in these cases too.
Signed-off-by: Kenneth Graunke <[email protected]> --- src/glsl/glsl_symbol_table.h | 30 +----------------------------- src/glsl/loop_analysis.h | 17 +---------------- 2 files changed, 2 insertions(+), 45 deletions(-) diff --git a/src/glsl/glsl_symbol_table.h b/src/glsl/glsl_symbol_table.h index 62d26b8..bd3860f 100644 --- a/src/glsl/glsl_symbol_table.h +++ b/src/glsl/glsl_symbol_table.h @@ -43,36 +43,8 @@ class symbol_table_entry; * type safe and some symbol table invariants. */ struct glsl_symbol_table { -private: - static void - _glsl_symbol_table_destructor (glsl_symbol_table *table) - { - table->~glsl_symbol_table(); - } - public: - /* Callers of this ralloc-based new need not call delete. It's - * easier to just ralloc_free 'ctx' (or any of its ancestors). */ - static void* operator new(size_t size, void *ctx) - { - void *table; - - table = ralloc_size(ctx, size); - assert(table != NULL); - - ralloc_set_destructor(table, (void (*)(void*)) _glsl_symbol_table_destructor); - - return table; - } - - /* If the user *does* call delete, that's OK, we will just - * ralloc_free in that case. Here, C++ will have already called the - * destructor so tell ralloc not to do that again. */ - static void operator delete(void *table) - { - ralloc_set_destructor(table, NULL); - ralloc_free(table); - } + DECLARE_RALLOC_CXX_OPERATORS(glsl_symbol_table) glsl_symbol_table(); ~glsl_symbol_table(); diff --git a/src/glsl/loop_analysis.h b/src/glsl/loop_analysis.h index 769d626..45359e7 100644 --- a/src/glsl/loop_analysis.h +++ b/src/glsl/loop_analysis.h @@ -141,22 +141,7 @@ public: hash_table_dtor(this->var_hash); } - static void* operator new(size_t size, void *ctx) - { - void *lvs = ralloc_size(ctx, size); - assert(lvs != NULL); - - ralloc_set_destructor(lvs, (void (*)(void*)) destructor); - - return lvs; - } - -private: - static void - destructor(loop_variable_state *lvs) - { - lvs->~loop_variable_state(); - } + DECLARE_RALLOC_CXX_OPERATORS(loop_variable_state) }; -- 1.8.3.4 _______________________________________________ mesa-dev mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/mesa-dev
