Module Name: src
Committed By: christos
Date: Mon Nov 27 16:37:21 UTC 2017
Modified Files:
src/lib/libc/gen: vis.c
Log Message:
Use 16x instead of 4x the amount of space since each wint_t can result in
4 bytes of 4 characters ("\ooo") each.
To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.74 src/lib/libc/gen/vis.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/lib/libc/gen/vis.c
diff -u src/lib/libc/gen/vis.c:1.73 src/lib/libc/gen/vis.c:1.74
--- src/lib/libc/gen/vis.c:1.73 Sat Apr 22 21:58:48 2017
+++ src/lib/libc/gen/vis.c Mon Nov 27 11:37:21 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: vis.c,v 1.73 2017/04/23 01:58:48 christos Exp $ */
+/* $NetBSD: vis.c,v 1.74 2017/11/27 16:37:21 christos 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.73 2017/04/23 01:58:48 christos Exp $");
+__RCSID("$NetBSD: vis.c,v 1.74 2017/11/27 16:37:21 christos Exp $");
#endif /* LIBC_SCCS and not lint */
#ifdef __FBSDID
__FBSDID("$FreeBSD$");
@@ -432,10 +432,10 @@ istrsenvisx(char **mbdstp, size_t *dlen,
mdst = NULL;
if ((psrc = calloc(mbslength + 1, sizeof(*psrc))) == NULL)
return -1;
- if ((pdst = calloc((4 * mbslength) + 1, sizeof(*pdst))) == NULL)
+ if ((pdst = calloc((16 * mbslength) + 1, sizeof(*pdst))) == NULL)
goto out;
if (*mbdstp == NULL) {
- if ((mdst = calloc((4 * mbslength) + 1, sizeof(*mdst))) == NULL)
+ if ((mdst = calloc((16 * mbslength) + 1, sizeof(*mdst))) == NULL)
goto out;
*mbdstp = mdst;
}
@@ -468,12 +468,13 @@ istrsenvisx(char **mbdstp, size_t *dlen,
clen = 1;
cerr = 1;
}
- if (clen == 0)
+ if (clen == 0) {
/*
* NUL in input gives 0 return value. process
* as single NUL byte and keep going.
*/
clen = 1;
+ }
/* Advance buffer character pointer. */
src++;
/* Advance input pointer by number of bytes read. */