[Mesa-dev] [PATCH 3/5] i965, mesa: Use the new DECLARE_R[Z]ALLOC_CXX_OPERATORS macros.
Chad Versace
chad.versace at linux.intel.com
Thu Sep 19 12:22:55 PDT 2013
On 09/18/2013 02:55 PM, Kenneth Graunke wrote:
> These classes declared a placement new operator, but didn't declare a
> delete operator. Switching to the macro gives them a delete operator,
> which probably is a good idea anyway.
>
> This also eliminates a lot of boilerplate.
>
> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
> ---
> src/mesa/drivers/dri/i965/brw_cfg.h | 20 ++----------
> src/mesa/drivers/dri/i965/brw_fs.h | 34 ++------------------
> src/mesa/drivers/dri/i965/brw_fs_live_variables.h | 10 +-----
> src/mesa/drivers/dri/i965/brw_vec4.h | 36 ++--------------------
> .../drivers/dri/i965/brw_vec4_live_variables.h | 10 +-----
> src/mesa/program/ir_to_mesa.cpp | 12 +-------
> src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 12 +-------
> 7 files changed, 12 insertions(+), 122 deletions(-)
> diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp
> index cef32dc..9612f4e 100644
> --- a/src/mesa/program/ir_to_mesa.cpp
> +++ b/src/mesa/program/ir_to_mesa.cpp
> @@ -149,17 +149,7 @@ dst_reg::dst_reg(src_reg reg)
>
> class ir_to_mesa_instruction : public exec_node {
> 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 *node;
> -
> - node = rzalloc_size(ctx, size);
> - assert(node != NULL);
> -
> - return node;
> - }
> + DECLARE_RALLOC_CXX_OPERATORS(ir_to_mesa_instruction)
>
> enum prog_opcode op;
> dst_reg dst;
> diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> index 0a1837f..0e2682a 100644
> --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> @@ -217,17 +217,7 @@ st_dst_reg::st_dst_reg(st_src_reg reg)
>
> class glsl_to_tgsi_instruction : public exec_node {
> 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 *node;
> -
> - node = rzalloc_size(ctx, size);
> - assert(node != NULL);
> -
> - return node;
> - }
> + DECLARE_RALLOC_CXX_OPERATORS(glsl_to_tgsi_instruction)
>
> unsigned op;
> st_dst_reg dst;
>
These last two change rzalloc to ralloc. I assume that's a copy-paste error.
Other than that, patches 1-3 are
Reviewed-by: Chad Versace <chad.versace at linux.intel.com>
More information about the mesa-dev
mailing list