From 52d2b28f7f107fbaff023533a15058055fa73bf0 Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Fri, 7 Oct 2016 00:34:26 +0200 Subject: ralloc: use rzalloc where it's necessary MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit No change in behavior. ralloc_size is equivalent to rzalloc_size. That will change though. Calls not switched to rzalloc_size: - ralloc_vasprintf - glsl_type::name allocation (it's filled with snprintf) - C++ classes where valgrind didn't show uninitialized values I switched most of non-glsl stuff to rzalloc without checking whether it's really needed. Reviewed-by: Edward O'Callaghan Tested-by: Edmondo Tommasina Reviewed-by: Nicolai Hähnle --- src/compiler/glsl/ast.h | 2 +- src/compiler/glsl/ast_to_hir.cpp | 4 ++-- src/compiler/glsl/glsl_parser_extras.h | 2 +- src/compiler/glsl/link_uniform_blocks.cpp | 2 +- src/compiler/glsl/list.h | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src/compiler/glsl') diff --git a/src/compiler/glsl/ast.h b/src/compiler/glsl/ast.h index 55f009ac857..063a9b43af0 100644 --- a/src/compiler/glsl/ast.h +++ b/src/compiler/glsl/ast.h @@ -49,7 +49,7 @@ struct YYLTYPE; */ class ast_node { public: - DECLARE_RALLOC_CXX_OPERATORS(ast_node); + DECLARE_RZALLOC_CXX_OPERATORS(ast_node); /** * Print an AST node in something approximating the original GLSL code diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp index a9a1ba3c48c..24067b6ac0c 100644 --- a/src/compiler/glsl/ast_to_hir.cpp +++ b/src/compiler/glsl/ast_to_hir.cpp @@ -6639,8 +6639,8 @@ ast_process_struct_or_iface_block_members(exec_list *instructions, * the types to HIR. This ensures that structure definitions embedded in * other structure definitions or in interface blocks are processed. */ - glsl_struct_field *const fields = ralloc_array(state, glsl_struct_field, - decl_count); + glsl_struct_field *const fields = rzalloc_array(state, glsl_struct_field, + decl_count); bool first_member = true; bool first_member_has_explicit_location = false; diff --git a/src/compiler/glsl/glsl_parser_extras.h b/src/compiler/glsl/glsl_parser_extras.h index 5bdebf684bb..e50d08ad38c 100644 --- a/src/compiler/glsl/glsl_parser_extras.h +++ b/src/compiler/glsl/glsl_parser_extras.h @@ -76,7 +76,7 @@ struct _mesa_glsl_parse_state { _mesa_glsl_parse_state(struct gl_context *_ctx, gl_shader_stage stage, void *mem_ctx); - DECLARE_RALLOC_CXX_OPERATORS(_mesa_glsl_parse_state); + DECLARE_RZALLOC_CXX_OPERATORS(_mesa_glsl_parse_state); /** * Generate a string representing the GLSL version currently being compiled diff --git a/src/compiler/glsl/link_uniform_blocks.cpp b/src/compiler/glsl/link_uniform_blocks.cpp index c0bdfa934e0..1fc0e2d5109 100644 --- a/src/compiler/glsl/link_uniform_blocks.cpp +++ b/src/compiler/glsl/link_uniform_blocks.cpp @@ -310,7 +310,7 @@ create_buffer_blocks(void *mem_ctx, struct gl_context *ctx, /* Allocate storage to hold all of the information related to uniform * blocks that can be queried through the API. */ - struct gl_uniform_block *blocks = ralloc_array(mem_ctx, gl_uniform_block, num_blocks); + struct gl_uniform_block *blocks = rzalloc_array(mem_ctx, gl_uniform_block, num_blocks); gl_uniform_buffer_variable *variables = ralloc_array(blocks, gl_uniform_buffer_variable, num_variables); diff --git a/src/compiler/glsl/list.h b/src/compiler/glsl/list.h index b5b5b362afd..6afb9dcef94 100644 --- a/src/compiler/glsl/list.h +++ b/src/compiler/glsl/list.h @@ -56,7 +56,7 @@ struct exec_node { struct exec_node *prev; #ifdef __cplusplus - DECLARE_RALLOC_CXX_OPERATORS(exec_node) + DECLARE_RZALLOC_CXX_OPERATORS(exec_node) exec_node() : next(NULL), prev(NULL) { -- cgit v1.2.3