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/nir/nir.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/compiler/nir/nir.c') diff --git a/src/compiler/nir/nir.c b/src/compiler/nir/nir.c index 31f0bcb8d81..cfb032c68b9 100644 --- a/src/compiler/nir/nir.c +++ b/src/compiler/nir/nir.c @@ -448,9 +448,10 @@ nir_alu_instr * nir_alu_instr_create(nir_shader *shader, nir_op op) { unsigned num_srcs = nir_op_infos[op].num_inputs; + /* TODO: don't use rzalloc */ nir_alu_instr *instr = - ralloc_size(shader, - sizeof(nir_alu_instr) + num_srcs * sizeof(nir_alu_src)); + rzalloc_size(shader, + sizeof(nir_alu_instr) + num_srcs * sizeof(nir_alu_src)); instr_init(&instr->instr, nir_instr_type_alu); instr->op = op; @@ -486,8 +487,9 @@ nir_intrinsic_instr * nir_intrinsic_instr_create(nir_shader *shader, nir_intrinsic_op op) { unsigned num_srcs = nir_intrinsic_infos[op].num_srcs; + /* TODO: don't use rzalloc */ nir_intrinsic_instr *instr = - ralloc_size(shader, + rzalloc_size(shader, sizeof(nir_intrinsic_instr) + num_srcs * sizeof(nir_src)); instr_init(&instr->instr, nir_instr_type_intrinsic); -- cgit v1.2.3