authorgravatar for pat.github@tullmann.orgPat Tullmann <pat.github@tullmann.org> 2023-11-28 19:55:35-08:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-06-05 22:43:53-07:00
log95a905336337a5f6eba39a31a28235885a12d48e
treebedf0ef8e843dcf30134ae003379a8283594ae1d
parent8a82496520ef25da9203dce527571c8e0574e6a6

glibc: strlcpy and strlcat arrived in glibc 2.38

So only expose these in generic-glibc/string.h if Zig is building a v2.38 (or later) glibc stub. Announcement of 2.38 that notes strlcpy and strlcat: https://lists.gnu.org/archive/html/info-gnu/2023-07/msg00010.html

1 files changed, 6 insertions(+), 0 deletions(-)

lib/libc/include/generic-glibc/string.h+6
......@@ -501,6 +501,11 @@ extern char *stpncpy (char *__restrict __dest,
501501 __THROW __nonnull ((1, 2));
502502#endif
503503
504/*
505 * strlcpy and strlcat introduced in glibc 2.38
506 * https://sourceware.org/git/?p=glibc.git;a=commit;h=2e0bbbfbf95fc9e22692e93658a6fbdd2d4554da
507 */
508#if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 38) || __GLIBC__ > 2
504509#ifdef __USE_MISC
505510/* Copy at most N - 1 characters from SRC to DEST. */
506511extern size_t strlcpy (char *__restrict __dest,
......@@ -513,6 +518,7 @@ extern size_t strlcat (char *__restrict __dest,
513518 const char *__restrict __src, size_t __n)
514519 __THROW __nonnull ((1, 2)) __attr_access ((__read_write__, 1, 3));
515520#endif
521#endif /* glibc v2.38 and later */
516522
517523#ifdef __USE_GNU
518524/* Compare S1 and S2 as strings holding name & indices/version numbers. */