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,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 29354 invoked from network); 31 May 2023 10:06:03 -0000 Received: from second.openwall.net (193.110.157.125) by inbox.vuxu.org with ESMTPUTF8; 31 May 2023 10:06:03 -0000 Received: (qmail 17843 invoked by uid 550); 31 May 2023 10:05:46 -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 17777 invoked from network); 31 May 2023 10:05:45 -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=gqSwxWSs2dWUkr8YEgPGj5GPMW7zeLAWQXh48sdMA4U=; b=cL2VM21lfueEyGsVnEJWCBF0evFP5OyIvTi8GU55kvz69n3xC5iiORdN gf5L9Cx57ap92iBbKhBdoqFX6ethYcpesyiCWWZEmuQB0f+eb4Ym5TZ7m YcaCriv+kwTOXdWKt18ArmtBMXiMji70JeTtXojk6fJWx2u9lAOzRoW26 M=; Authentication-Results: mail3-relais-sop.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,205,1681164000"; d="scan'208";a="57434660" From: Jens Gustedt To: musl@lists.openwall.com Date: Wed, 31 May 2023 12:05:15 +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/3] 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. --- dynamic.list | 2 ++ include/stdlib.h | 2 ++ src/malloc/free_aligned_sized.c | 6 ++++++ src/malloc/free_sized.c | 7 +++++++ 4 files changed, 17 insertions(+) create mode 100644 src/malloc/free_aligned_sized.c create mode 100644 src/malloc/free_sized.c diff --git a/dynamic.list b/dynamic.list index ee0d363b..f13db826 100644 --- a/dynamic.list +++ b/dynamic.list @@ -10,6 +10,8 @@ malloc; calloc; realloc; free; +free_sized; +free_aligned_sized; memalign; posix_memalign; aligned_alloc; diff --git a/include/stdlib.h b/include/stdlib.h index 037e4dc4..2f46e6aa 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_aligned_sized.c b/src/malloc/free_aligned_sized.c new file mode 100644 index 00000000..bdfd0cee --- /dev/null +++ b/src/malloc/free_aligned_sized.c @@ -0,0 +1,6 @@ +#include + +void free_aligned_sized (void *p, size_t alignment, size_t size) +{ + free(p); +} diff --git a/src/malloc/free_sized.c b/src/malloc/free_sized.c new file mode 100644 index 00000000..fbacc516 --- /dev/null +++ b/src/malloc/free_sized.c @@ -0,0 +1,7 @@ +#include + +void free_sized (void *p, size_t size) +{ + free(p); +} + -- 2.34.1