From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H2, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 31474 invoked from network); 24 May 2023 19:39:39 -0000 Received: from second.openwall.net (193.110.157.125) by inbox.vuxu.org with ESMTPUTF8; 24 May 2023 19:39:39 -0000 Received: (qmail 6094 invoked by uid 550); 24 May 2023 19:39:20 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 6011 invoked from network); 24 May 2023 19:39:19 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inria.fr; s=dc; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=mwYJwOYOSdPV7FXtcXSgXDDhONhswIfSb88tgVDahF8=; b=vZFNeJLFFxYFlY8J9kVJK4QsUjhLRr5azLYXPq2xKCcel8ufhLyg7pq4 DDn2FqouFDxjPuGCpFWznfaIGp1ZaP56Pf/mZO3oC9ZBuK1GfW26t2aIm uKxoDWUv1+EQ/RyLzl2zGoMfztSgPGnnLXomI0lewCbZMJfuYxvfiSSC6 8=; Authentication-Results: mail2-relais-roc.national.inria.fr; dkim=none (message not signed) header.i=none; spf=SoftFail smtp.mailfrom=Jens.Gustedt@inria.fr; dmarc=fail (p=none dis=none) d=inria.fr X-IronPort-AV: E=Sophos;i="6.00,190,1681164000"; d="scan'208";a="109526769" From: Jens Gustedt To: musl@lists.openwall.com Date: Wed, 24 May 2023 21:38:51 +0200 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [musl] [C23 new stdlib 1/4] C23: add the new interfaces free_sized and free_aligned_sized for stdlib.h For the moment, these are just trivial wrappers that ignored their parameters other than the pointer. The names were not previously reserved, so they could generate naming conflicts with application code. The "implementation" is just a trivial wrapper around free. This could eventually replaced by implementations that are more efficient than that. --- include/stdlib.h | 2 ++ src/malloc/free.c | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/include/stdlib.h b/include/stdlib.h index 8a873f03..7800074d 100644 --- a/include/stdlib.h +++ b/include/stdlib.h @@ -41,6 +41,8 @@ void *malloc (size_t); void *calloc (size_t, size_t); void *realloc (void *, size_t); void free (void *); +void free_sized (void *, size_t); +void free_aligned_sized (void *, size_t, size_t); void *aligned_alloc(size_t, size_t); __noreturn void abort (void); diff --git a/src/malloc/free.c b/src/malloc/free.c index 3944f7b2..2b7438bc 100644 --- a/src/malloc/free.c +++ b/src/malloc/free.c @@ -4,3 +4,13 @@ void free(void *p) { __libc_free(p); } + +void free_sized (void *p, size_t size) +{ + __libc_free(p); +} + +void free_aligned_sized (void *p, size_t alignment, size_t size) +{ + __libc_free(p); +} -- 2.34.1