[Mesa-dev] [PATCH 1/4] mesa/util: add util_dynarray_clear() helper

Thomas Helland thomashelland90 at gmail.com
Wed Jun 14 18:37:26 UTC 2017


2017-06-14 13:55 GMT+02:00 Samuel Pitoiset <samuel.pitoiset at gmail.com>:
> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
> ---
>  src/util/u_dynarray.h | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/src/util/u_dynarray.h b/src/util/u_dynarray.h
> index 57f96ff79c0..cc316323f28 100644
> --- a/src/util/u_dynarray.h
> +++ b/src/util/u_dynarray.h
> @@ -68,6 +68,12 @@ util_dynarray_fini(struct util_dynarray *buf)
>     }
>  }
>
> +static inline void
> +util_dynarray_clear(struct util_dynarray *buf)
> +{
> +       buf->size = 0;
> +}
> +

The indentation looks a bit off here? Also, I agree with Marek;
clear indicates to me that the memory is either freed or that
it is cleared to NULL.

>  #define DYN_ARRAY_INITIAL_SIZE 64
>
>  /* use util_dynarray_trim to reduce the allocated storage */
> --
> 2.13.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list