From patchwork Wed Mar 18 18:15:05 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alejandro Colomar X-Patchwork-Id: 131916 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id 3F1F34C31857 for ; Wed, 18 Mar 2026 18:16:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3F1F34C31857 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=PUR/0RRE X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from tor.source.kernel.org (tor.source.kernel.org [172.105.4.254]) by sourceware.org (Postfix) with ESMTPS id 02E524C31818 for ; Wed, 18 Mar 2026 18:15:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 02E524C31818 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=kernel.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=kernel.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 02E524C31818 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=172.105.4.254 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1773857713; cv=none; b=PQh4H7HpaG5b6tOvc/btoExNp6AjHrqJzA12R0rqR/SYZm++qJSrYqCEFW86EfVldx/aQub5kI2Hf5krRn4VYxgyqNQbd6cDiYDVEvnOmfCAJVpCCvdD93wD/UwAkxDY/Z/HFo6VcEmKNNR+9CEKWGibxjZVflorr2rk7ROYDko= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1773857713; c=relaxed/simple; bh=4FTO1QZhtXEVL+/f82nIiwGSCgVQYhwnO5HLbASeKYI=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=JAH0tFIz/E1pAAX8MZCqHSTPtiXT0UBgdHCUdsoNPPrVlRdZU/1Czx5RjpdO3jnlEsJkVb1WIsEQRZ8LJmL0eddk4LzeGTw3lu63+jI2PCfpby0pRTXAYohqLOxunh513SBDSVN9Fur+zYOt7zBPJrBK3egHUam+4+9UEzlwFos= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 02E524C31818 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by tor.source.kernel.org (Postfix) with ESMTP id 7BD1A60142; Wed, 18 Mar 2026 18:15:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 22C04C19421; Wed, 18 Mar 2026 18:15:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773857709; bh=4FTO1QZhtXEVL+/f82nIiwGSCgVQYhwnO5HLbASeKYI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=PUR/0RREBGibRpqhEXE2R91MaYjZqPfPpNldJ/4ec6aHk89RdUP5nYtbSmweCUGk3 ToNiO8sSrTcDk5wcUZjxyK7FORT54qVbr5EqW+oorjMSHa+AoB3RhvHkwqABfyrA15 FcZQmIH2mqpS031fBxyImQLvsKNeN8Q+r1SSAAdh1Cy7YF2VhzIiJ0rZqdrMmgEHpQ 1TI7rrsbYQolVwcp/tEiDPGS7Cq0d0GvTWlOxSmAuR9ttdb4eGKDmOJnfSnWYlxRXA EkrhUyR6xUksQBLktSU+RNZkNi4gHahtAJshma50P5cAUwPMpGFWRTCkzBVIaM9b7h 86LMdqgTqqN+A== Date: Wed, 18 Mar 2026 19:15:05 +0100 From: Alejandro Colomar To: libc-alpha@sourceware.org Cc: Alejandro Colomar , Joseph Myers , Paul Eggert , Adhemerval Zanella Netto , Florian Weimer , "Dmitry V. Levin" , Archie Cobbs , Solar Designer , Sam James Subject: [RFC v3 2/2] manual/: Prefer aprintf(3) over asprintf(3) Message-ID: <131b1f0c5ed14d3f869552bc84488b5877651c80.1773857304.git.alx@kernel.org> X-Mailer: git-send-email 2.53.0 References: <916855e5ad90ca3611a235ecbcf08a1359771eb9.1773775432.git.alx@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-9.1 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~patchwork=sourceware.org@sourceware.org Signed-off-by: Alejandro Colomar --- manual/examples/rprintf.c | 4 ++-- manual/stdio.texi | 4 ++-- manual/string.texi | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/manual/examples/rprintf.c b/manual/examples/rprintf.c index 734a8768..736ac169 100644 --- a/manual/examples/rprintf.c +++ b/manual/examples/rprintf.c @@ -38,8 +38,8 @@ print_widget (FILE *stream, /* Format the output into a string. */ w = *((const Widget **) (args[0])); - len = asprintf (&buffer, "", w, w->name); - if (len == -1) + buffer = aprintf ("", w, w->name); + if (buffer == NULL) return -1; /* Pad to the minimum field width and print to the stream. */ diff --git a/manual/stdio.texi b/manual/stdio.texi index e7deca78..91149626 100644 --- a/manual/stdio.texi +++ b/manual/stdio.texi @@ -2458,7 +2458,7 @@ because it can potentially output more characters than can fit in the allocation size of the string @var{s}. Remember that the field width given in a conversion specification is only a @emph{minimum} value. -To avoid this problem, you can use @code{snprintf} or @code{asprintf}, +To avoid this problem, you can use @code{snprintf} or @code{aprintf}, described below. @end deftypefun @@ -2543,7 +2543,7 @@ make_message (char *name, char *value) @end group @end smallexample -In practice, it is often easier just to use @code{asprintf}, below. +In practice, it is often easier just to use @code{aprintf}, below. @strong{Attention:} In versions of @theglibc{} prior to 2.1 the return value is the number of characters stored, not including the diff --git a/manual/string.texi b/manual/string.texi index 24004f1f..7a6ee12a 100644 --- a/manual/string.texi +++ b/manual/string.texi @@ -1198,7 +1198,7 @@ strings to fit arbitrary size limits. @xref{Semantics, , Writing Robust Programs, standards, The GNU Coding Standards}. Instead of string-truncation functions, it is usually better to use dynamic memory allocation (@pxref{Unconstrained Allocation}) and functions -such as @code{strdup} or @code{asprintf} to construct strings. +such as @code{strdup} or @code{aprintf} to construct strings. @node String/Array Comparison @section String/Array Comparison