Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-8]: src/lib/libc/gen Pull up the following, requested by maya in ...



details:   https://anonhg.NetBSD.org/src/rev/d1a6759f1af4
branches:  netbsd-8
changeset: 851306:d1a6759f1af4
user:      martin <martin%NetBSD.org@localhost>
date:      Tue Jan 16 14:15:50 2018 +0000

description:
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.

diffstat:

 lib/libc/gen/vis.c |  11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diffs (46 lines):

diff -r f9e0bdac5d5a -r d1a6759f1af4 lib/libc/gen/vis.c
--- a/lib/libc/gen/vis.c        Tue Jan 16 14:08:56 2018 +0000
+++ b/lib/libc/gen/vis.c        Tue Jan 16 14:15:50 2018 +0000
@@ -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 @@
        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 @@
                        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. */



Home | Main Index | Thread Index | Old Index