[RFC,v3,2/2] manual/: Prefer aprintf(3) over asprintf(3)

Message ID 131b1f0c5ed14d3f869552bc84488b5877651c80.1773857304.git.alx@kernel.org (mailing list archive)
State New
Headers
Series Add [v]aprintf(3) |

Checks

Context Check Description
redhat-pt-bot/TryBot-apply_patch success Patch applied to master at the time it was sent
redhat-pt-bot/TryBot-32bit fail Patch caused testsuite regressions
linaro-tcwg-bot/tcwg_glibc_build--master-arm warning Skipped because it is an RFC
linaro-tcwg-bot/tcwg_glibc_build--master-aarch64 warning Skipped because it is an RFC

Commit Message

Alejandro Colomar March 18, 2026, 6:15 p.m. UTC
  Signed-off-by: Alejandro Colomar <alx@kernel.org>
---
 manual/examples/rprintf.c | 4 ++--
 manual/stdio.texi         | 4 ++--
 manual/string.texi        | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)
  

Patch

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, "<Widget %p: %s>", w, w->name);
-  if (len == -1)
+  buffer = aprintf ("<Widget %p: %s>", 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