[Mesa-dev] [PATCH 3/5] i965, mesa: Use the new DECLARE_R[Z]ALLOC_CXX_OPERATORS macros.
Eric Anholt
eric at anholt.net
Thu Sep 19 08:37:03 PDT 2013
Kenneth Graunke <kenneth at whitecape.org> writes:
> 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>
> 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 two went from rzalloc to ralloc, apparently unintentionally.
Other than that, this series is:
Reviewed-by: Eric Anholt <eric at anholt.net>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20130919/f8437614/attachment-0001.pgp>
More information about the mesa-dev
mailing list