Module Name: src Committed By: martin Date: Tue Jan 16 14:15:50 UTC 2018
Modified Files: src/lib/libc/gen [netbsd-8]: vis.c Log Message: Pull up the following, requested by maya in #411: lib/libc/gen/vis.c 1.74 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.73.4.1 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.73.4.1 --- src/lib/libc/gen/vis.c:1.73 Sun Apr 23 01:58:48 2017 +++ src/lib/libc/gen/vis.c Tue Jan 16 14:15:50 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: vis.c,v 1.73 2017/04/23 01:58:48 christos Exp $ */ +/* $NetBSD: vis.c,v 1.73.4.1 2018/01/16 14:15:50 martin 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.73.4.1 2018/01/16 14:15:50 martin 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. */