From patchwork Sat Feb 8 19:01:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 37776 Received: (qmail 67724 invoked by alias); 8 Feb 2020 19:01:20 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 67645 invoked by uid 89); 8 Feb 2020 19:01:20 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-18.7 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy= X-HELO: us-smtp-1.mimecast.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1581188477; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GIwkavasKOqUHwtj/6jFSyVX00MLw7GVn0swqWAdGpY=; b=XYgS/Vi/sXJOqvpQdVfgYH0I643P+LyMufOV7IU3r0njI1q5fGW+QhAQBEsivAC9Du4DMQ waUiIZsw78xTFAqO9JKG79btma0IbtxKOPnQqp4dHwOUMExt9mbaI+/SsrMRFYFDqr0Sb1 PrrjF+Vc7WcVX8oNc4F9gTCa0goO6v8= From: Florian Weimer To: libc-alpha@sourceware.org Subject: [PATCH 3/4] Remove weak declaration of free from In-Reply-To: References: Message-Id: Date: Sat, 08 Feb 2020 20:01:11 +0100 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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. Reviewed-by: Carlos O'Donell --- 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); - 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); 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); 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); /* Use the free() corresponding to the malloc() above to free this up. */