On 9/14/21 2:40 PM, наб wrote:
str[n]dupa() are available on every modern compiler platform, incl. Clang, ICC, &c. By shortening the third paragraph, it now reads strdupa() and strndupa() are similar, but use alloca(3) to allocate the buffer. pointing squarely to alloca(3), which is scary enough, so drop the extraneous warning, too ‒ athis clearly points to
(I fixed s/athis/this/)
"see alloca(3) for the limitations of that allocator". Plus, it's not like malloc(3) doesn't have its problems, too, but I don't see those being touted in the first paragraph; reducing these to the bare minimum, strdup() copies into malloc(3) and you can free it with free(3), strndup() likewise, but up to n, and str[n]dupa() use alloca(3) instead ‒ be wary of what alloca(3) does! doesn't really make sense ‒ it's obvious that, ex definitione, alloca(3) suffers from alloca(3) problems and input limits, just like malloc(3) from the malloc(3) suite's. Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@xxxxxxxxxxxxxxxxxx>
наб, patch applied! Thanks, Alex
--- man3/strdup.3 | 3 --- 1 file changed, 3 deletions(-) diff --git a/man3/strdup.3 b/man3/strdup.3 index 1e1ac34de..963de7d48 100644 --- a/man3/strdup.3 +++ b/man3/strdup.3 @@ -99,9 +99,6 @@ and are similar, but use .BR alloca (3) to allocate the buffer. -They are available only when using the GNU -GCC suite, and suffer from the same limitations described in -.BR alloca (3). .SH RETURN VALUE On success, the .BR strdup ()
-- Alejandro Colomar Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/ http://www.alejandro-colomar.es/