summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorriastradh <riastradh@NetBSD.org>2023-06-29 16:11:31 +0000
committerriastradh <riastradh@NetBSD.org>2023-06-29 16:11:31 +0000
commit3a21b4f1009c422e2485c5d90b71dfc4a9ade298 (patch)
tree4baf49272e60423d160fed7521bda244a0739990 /lib
parent1eb385c6ee986395720b4cb03f209a5201ce873f (diff)
vis(3): Avoid nonportable MIN in portable code.
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/gen/vis.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/libc/gen/vis.c b/lib/libc/gen/vis.c
index cd10c097d97..ecc304c8015 100644
--- a/lib/libc/gen/vis.c
+++ b/lib/libc/gen/vis.c
@@ -1,4 +1,4 @@
-/* $NetBSD: vis.c,v 1.75 2021/06/18 10:57:14 christos Exp $ */
+/* $NetBSD: vis.c,v 1.76 2023/06/29 16:11:31 riastradh Exp $ */
/*-
* Copyright (c) 1989, 1993
@@ -57,7 +57,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: vis.c,v 1.75 2021/06/18 10:57:14 christos Exp $");
+__RCSID("$NetBSD: vis.c,v 1.76 2023/06/29 16:11:31 riastradh Exp $");
#endif /* LIBC_SCCS and not lint */
#ifdef __FBSDID
__FBSDID("$FreeBSD$");
@@ -466,7 +466,10 @@ istrsenvisx(char **mbdstp, size_t *dlen, const char *mbsrc, size_t mblength,
while (mbslength > 0) {
/* Convert one multibyte character to wchar_t. */
if (!cerr)
- clen = mbrtowc(src, mbsrc, MIN(mbslength, MB_LEN_MAX),
+ clen = mbrtowc(src, mbsrc,
+ (mbslength < MB_LEN_MAX
+ ? mbslength
+ : MB_LEN_MAX),
&mbstate);
if (cerr || clen < 0) {
/* Conversion error, process as a byte instead. */