mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Ismael Luceno <ismael@iodev.co.uk>
To: musl@lists.openwall.com
Cc: Rich Felker <dalias@libc.org>, Ismael Luceno <ismael@iodev.co.uk>
Subject: [musl] [RFC PATCH] implement strndupa
Date: Fri, 21 Oct 2022 23:17:20 +0200	[thread overview]
Message-ID: <20221021211720.16465-1-ismael@iodev.co.uk> (raw)

Signed-off-by: Ismael Luceno <ismael@iodev.co.uk>
---
 include/string.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/string.h b/include/string.h
index 43ad0942edd5..fda7b2e4f57c 100644
--- a/include/string.h
+++ b/include/string.h
@@ -89,6 +89,7 @@ void explicit_bzero (void *, size_t);
 
 #ifdef _GNU_SOURCE
 #define	strdupa(x)	strcpy(alloca(strlen(x)+1),x)
+#define	strndupa(x, n)	strlcpy(alloca(strnlen((x), (n)), (x), (n))
 int strverscmp (const char *, const char *);
 char *strchrnul(const char *, int);
 char *strcasestr(const char *, const char *);
-- 
2.38.1


             reply	other threads:[~2022-10-21 21:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-21 21:17 Ismael Luceno [this message]
2022-10-21 22:09 ` James Y Knight
2022-10-22  0:26   ` Rich Felker

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=20221021211720.16465-1-ismael@iodev.co.uk \
    --to=ismael@iodev.co.uk \
    --cc=dalias@libc.org \
    --cc=musl@lists.openwall.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

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 NNTP newsgroup(s).