unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Carlos O'Donell <codonell@redhat.com>
To: Florian Weimer <fweimer@redhat.com>, libc-alpha@sourceware.org
Subject: Re: [PATCH 3/4] Remove weak declaration of free from <inline-hashtab.h>
Date: Fri, 14 Feb 2020 17:36:36 -0500	[thread overview]
Message-ID: <ac7164e7-ada5-2194-5c60-d19087d14b88@redhat.com> (raw)
In-Reply-To: <c1cfeffdf9edaf3ffd8259aa43de17b75737984c.1581182210.git.fweimer@redhat.com>

On 2/8/20 2:01 PM, Florian Weimer wrote:
> elf/dl-minimal.c provides a definition of free, so the function
> pointer is always non-null, even before the final relocation
> of the loader.

Agreed.

OK for master.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>

> ---
>  include/inline-hashtab.h | 11 +++--------
>  1 file changed, 3 insertions(+), 8 deletions(-)
> 
> diff --git a/include/inline-hashtab.h b/include/inline-hashtab.h
> index d25bb95083..3c09978199 100644
> --- a/include/inline-hashtab.h
> +++ b/include/inline-hashtab.h
> @@ -25,8 +25,6 @@
>  #ifndef INLINE_HASHTAB_H
>  # define INLINE_HASHTAB_H 1
>  
> -extern void weak_function free (void *ptr);
> -

OK.

>  struct hashtab
>  {
>    /* Table itself.  */
> @@ -56,8 +54,7 @@ htab_create (void)
>    ht->free = free;
>    if (! ht->entries)
>      {
> -      if (ht->free)
> -	ht->free (ht);
> +      free (ht);

OK.

>        return NULL;
>      }
>  
> @@ -78,8 +75,7 @@ htab_delete (struct hashtab *htab)
>    for (i = htab->size - 1; i >= 0; i--)
>      free (htab->entries[i]);
>  
> -  if (htab->free)
> -    htab->free (htab->entries);
> +  htab->free (htab->entries);

OK.

>    free (htab);
>  }
>  
> @@ -167,8 +163,7 @@ htab_expand (struct hashtab *htab, int (*hash_fn) (void *))
>       allocated early as long as there's no corresponding free(), but
>       this isn't so much memory as to be significant.  */
>  
> -  if (htab->free)
> -    htab->free (oentries);
> +  htab->free (oentries);

OK.

>  
>    /* Use the free() corresponding to the malloc() above to free this
>       up.  */
> 


-- 
Cheers,
Carlos.


  reply	other threads:[~2020-02-14 22:37 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-08 19:00 [PATCH 0/4] Avoid malloc symbol interposition in the dynamic loader [BZ #25486] Florian Weimer
2020-02-08 19:00 ` [PATCH 1/4] elf: Introduce the rtld-stubbed-symbols makefile variable Florian Weimer
2020-02-14 22:36   ` Carlos O'Donell
2020-02-08 19:01 ` [PATCH 2/4] elf: Extract _dl_sym_post, _dl_sym_find_caller_map from elf/dl-sym.c Florian Weimer
2020-02-14 22:36   ` Carlos O'Donell
2020-02-08 19:01 ` [PATCH 3/4] Remove weak declaration of free from <inline-hashtab.h> Florian Weimer
2020-02-14 22:36   ` Carlos O'Donell [this message]
2020-02-08 19:01 ` [PATCH 4/4] ld.so: Do not export free/calloc/malloc/realloc functions [BZ #25486] Florian Weimer
2020-02-14 22:36   ` Carlos O'Donell
2020-02-24 11:53   ` Florian Weimer
2020-02-14 22:36 ` [PATCH 0/4] Avoid malloc symbol interposition in the dynamic loader " Carlos O'Donell
2020-02-17 12:25 ` Lucas A. M. Magalhaes

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/libc/involved.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ac7164e7-ada5-2194-5c60-d19087d14b88@redhat.com \
    --to=codonell@redhat.com \
    --cc=fweimer@redhat.com \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).