[Mesa-dev] [PATCH 2/2] ralloc: Delete autofree handling.

Marek Olšák maraeo at gmail.com
Mon Feb 27 13:34:14 UTC 2017


For the series:

Reviewed-by: Marek Olšák <marek.olsak at amd.com>

Marek

On Mon, Feb 27, 2017 at 1:23 PM, Kenneth Graunke <kenneth at whitecape.org> wrote:
> There was exactly one user of this, and I just removed it.
>
> It also accessed an implicit global context, with no locking.  This
> meant that it was only safe if all callers of ralloc_autofree_context()
> held the same lock...which is a pretty terrible thing for a utility
> library to impose.
>
> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
> ---
>  src/util/ralloc.c | 18 ------------------
>  src/util/ralloc.h |  9 ---------
>  2 files changed, 27 deletions(-)
>
> diff --git a/src/util/ralloc.c b/src/util/ralloc.c
> index 980e4e4f138..d5cc16766b1 100644
> --- a/src/util/ralloc.c
> +++ b/src/util/ralloc.c
> @@ -323,24 +323,6 @@ ralloc_parent(const void *ptr)
>     return info->parent ? PTR_FROM_HEADER(info->parent) : NULL;
>  }
>
> -static void *autofree_context = NULL;
> -
> -static void
> -autofree(void)
> -{
> -   ralloc_free(autofree_context);
> -}
> -
> -void *
> -ralloc_autofree_context(void)
> -{
> -   if (unlikely(autofree_context == NULL)) {
> -      autofree_context = ralloc_context(NULL);
> -      atexit(autofree);
> -   }
> -   return autofree_context;
> -}
> -
>  void
>  ralloc_set_destructor(const void *ptr, void(*destructor)(void *))
>  {
> diff --git a/src/util/ralloc.h b/src/util/ralloc.h
> index 3e2d342b45e..7d906519661 100644
> --- a/src/util/ralloc.h
> +++ b/src/util/ralloc.h
> @@ -247,15 +247,6 @@ void ralloc_adopt(const void *new_ctx, void *old_ctx);
>  void *ralloc_parent(const void *ptr);
>
>  /**
> - * Return a context whose memory will be automatically freed at program exit.
> - *
> - * The first call to this function creates a context and registers a handler
> - * to free it using \c atexit.  This may cause trouble if used in a library
> - * loaded with \c dlopen.
> - */
> -void *ralloc_autofree_context(void);
> -
> -/**
>   * Set a callback to occur just before an object is freed.
>   */
>  void ralloc_set_destructor(const void *ptr, void(*destructor)(void *));
> --
> 2.11.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