On Wednesday, May 06, 2015 03:35:27 PM Juha-Pekka Heikkila wrote:
> rzalloc_size() call ralloc_size() to allocate memory. ralloc_size()
> use calloc to get memory thus zeroing in rzalloc_size is not
> necessary.
> 
> Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikk...@gmail.com>
> ---
>  src/util/ralloc.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/src/util/ralloc.c b/src/util/ralloc.c
> index 01719c8..09f5fcd 100644
> --- a/src/util/ralloc.c
> +++ b/src/util/ralloc.c
> @@ -132,8 +132,6 @@ void *
>  rzalloc_size(const void *ctx, size_t size)
>  {
>     void *ptr = ralloc_size(ctx, size);
> -   if (likely(ptr != NULL))
> -      memset(ptr, 0, size);
>     return ptr;
>  }
>  
> 

Wow, I have no idea why I did that.  This is certainly
counter-intuitive.

rzalloc() is supposed to guarantee zeroed memory.  ralloc() is not, but
it looks like it always has for some reason.  I'm somewhat inclined to
change ralloc_size() to use malloc instead of calloc.

I wonder how many things would break :)

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to