public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Florian Weimer <fweimer@redhat.com>
Cc: libc-alpha@sourceware.org
Subject: Re: [PATCH 2/2] Add the wcslcpy, wcslcat functions
Date: Sat, 8 Apr 2023 15:09:09 -0700	[thread overview]
Message-ID: <d1f79ca8-bf17-f5ff-52a4-2cd9bfa48278@cs.ucla.edu> (raw)
In-Reply-To: <6c94849aad1952b50504894b35fa462d445c3a4f.1680693362.git.fweimer@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 339 bytes --]

Although I didn't look at the wcslcpy/wcslcat code carefully, it clearly 
has problems similar to those of the strlcpy/strlcat code and should be 
fixed the same way. Nobody uses these functions, so their performance 
does not matter. Certainly we should not try to optimize them.

The manual could use a bit of fixup; please see attached.

[-- Attachment #2: 0001-manual-improve-wcslcpy-wcslcat-doc.patch --]
[-- Type: text/x-patch, Size: 3055 bytes --]

From 611f53a510743e74af9c694251c058e5b7507b6f Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Sat, 8 Apr 2023 13:54:37 -0700
Subject: [PATCH] manual: improve wcslcpy/wcslcat doc

Mention OpenBSD versions, and mention the new
functions elsewhere when appropriate.
---
 manual/maint.texi  |  4 ++++
 manual/string.texi | 13 +++++++------
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/manual/maint.texi b/manual/maint.texi
index 3ad4647cf3..89da704f45 100644
--- a/manual/maint.texi
+++ b/manual/maint.texi
@@ -415,6 +415,10 @@ The following functions and macros are fortified in @theglibc{}:
 
 @item @code{wcscpy}
 
+@item @code{wcslcat}
+
+@item @code{wcslcpy}
+
 @item @code{wcsncat}
 
 @item @code{wcsncpy}
diff --git a/manual/string.texi b/manual/string.texi
index 781fba245a..d2c3b6c902 100644
--- a/manual/string.texi
+++ b/manual/string.texi
@@ -727,7 +727,8 @@ As noted below, this function has significant performance issues.
 @end deftypefun
 
 Programmers using the @code{strcat} or @code{wcscat} functions (or the
-@code{strlcat}, @code{strncat} and @code{wcsncat} functions defined in
+@code{strlcat}, @code{strncat}, @code{wcslcat}
+and @code{wcsncat} functions defined in
 a later section, for that matter)
 can easily be recognized as lazy and reckless.  In almost all situations
 the lengths of the participating strings are known (it better should be
@@ -849,7 +850,7 @@ Whenever a programmer feels the need to use @code{strcat} she or he
 should think twice and look through the program to see whether the code cannot
 be rewritten to take advantage of already calculated results.
 The related functions @code{strlcat}, @code{strncat},
-@code{wcscat} and @code{wcsncat}
+@code{wcscat}, @code{wcslcat} and @code{wcsncat}
 are almost always unnecessary, too.
 Again: it is almost always unnecessary to use functions like @code{strcat}.
 
@@ -1121,10 +1122,10 @@ This function is derived from OpenBSD 2.4.
 @standards{BSD, string.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 This function is a variant of @code{strlcpy} for wide strings.
-The  @var{size} argument counts the length of the destination buffer in
+The @var{size} argument counts the length of the destination buffer in
 wide characters (and not bytes).
 
-This function is derived from BSD.
+This function is derived from OpenBSD 3.8.
 @end deftypefun
 
 @deftypefun size_t strlcat (char *restrict @var{to}, const char *restrict @var{from}, size_t @var{size})
@@ -1167,10 +1168,10 @@ This function is derived from OpenBSD 2.4.
 @standards{BSD, string.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 This function is a variant of @code{strlcat} for wide strings.
-The  @var{size} argument counts the length of the destination buffer in
+The @var{size} argument counts the length of the destination buffer in
 wide characters (and not bytes).
 
-This function is derived from BSD.
+This function is derived from OpenBSD 3.8.
 @end deftypefun
 
 Because these functions can abruptly truncate strings or wide strings,
-- 
2.39.2


  reply	other threads:[~2023-04-08 22:09 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-05 11:20 [PATCH 0/2] strlcpy/strlcat/wcslcpy/wcscat implementation Florian Weimer
2023-04-05 11:20 ` [PATCH 1/2] Implement strlcpy and strlcat [BZ #178] Florian Weimer
2023-04-05 13:18   ` Adhemerval Zanella Netto
2023-04-06  9:18     ` Florian Weimer
2023-04-06 14:22   ` Siddhesh Poyarekar
2023-04-06 15:09     ` Florian Weimer
2023-04-06 21:29     ` Alejandro Colomar
2023-04-11 14:28       ` Siddhesh Poyarekar
2023-04-20 10:55     ` Florian Weimer
2023-04-20 11:45       ` Siddhesh Poyarekar
2023-04-21 17:45         ` Florian Weimer
2023-04-06 21:21   ` Alejandro Colomar
2023-04-06 21:35     ` Florian Weimer
2023-04-06 22:15       ` Alejandro Colomar
2023-04-06 22:19       ` Alejandro Colomar
2023-04-06 22:34     ` Alejandro Colomar
2023-04-08 22:08   ` Paul Eggert
2023-04-09 15:29     ` Paul Eggert
2023-04-13 11:37       ` Florian Weimer
2023-04-13 14:39         ` Paul Eggert
2023-04-13 17:59           ` Paul Eggert
2023-04-20  8:07     ` Florian Weimer
2023-04-21 19:00       ` Paul Eggert
2023-04-28  8:49         ` Florian Weimer
2023-04-05 11:20 ` [PATCH 2/2] Add the wcslcpy, wcslcat functions Florian Weimer
2023-04-08 22:09   ` Paul Eggert [this message]
2023-04-05 12:30 ` [PATCH 0/2] strlcpy/strlcat/wcslcpy/wcscat implementation Alejandro Colomar
2023-04-08 22:05 ` Paul Eggert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d1f79ca8-bf17-f5ff-52a4-2cd9bfa48278@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=fweimer@redhat.com \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).