Source-Changes-HG archive

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

[src/trunk]: src/lib/libedit - in the argv conversion, handle NULL as NULL



details:   https://anonhg.NetBSD.org/src/rev/6b22b574a42a
branches:  trunk
changeset: 750739:6b22b574a42a
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Jan 12 19:37:18 2010 +0000

description:
- in the argv conversion, handle NULL as NULL
- when printing tab/nl print them, don't handle them specially.

diffstat:

 lib/libedit/chartype.c |  10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diffs (45 lines):

diff -r 5691ce556b47 -r 6b22b574a42a lib/libedit/chartype.c
--- a/lib/libedit/chartype.c    Tue Jan 12 18:43:37 2010 +0000
+++ b/lib/libedit/chartype.c    Tue Jan 12 19:37:18 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: chartype.c,v 1.2 2009/12/31 18:32:37 christos Exp $    */
+/*     $NetBSD: chartype.c,v 1.3 2010/01/12 19:37:18 christos Exp $    */
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
  */
 #include "config.h"
 #if !defined(lint) && !defined(SCCSID)
-__RCSID("$NetBSD: chartype.c,v 1.2 2009/12/31 18:32:37 christos Exp $");
+__RCSID("$NetBSD: chartype.c,v 1.3 2010/01/12 19:37:18 christos Exp $");
 #endif /* not lint && not SCCSID */
 #include "el.h"
 #include <stdlib.h>
@@ -159,7 +159,7 @@
        for (i = 0, p = conv->wbuff; i < argc; ++i) {
                if (!argv[i]) {   /* don't pass null pointers to mbstowcs */
                        wargv[i] = NULL;
-                       bytes = -1;
+                       continue;
                } else {
                        wargv[i] = p;
                        bytes = mbstowcs(p, argv[i], bufspace);
@@ -295,6 +295,8 @@
 {
        int t = ct_chr_class(c);
        switch (t) {
+       case CHTYPE_TAB:
+       case CHTYPE_NL:
        case CHTYPE_ASCIICTL:
                if (len < 2)
                        return -1;   /* insufficient space */
@@ -335,8 +337,6 @@
 #endif
                /*FALLTHROUGH*/
        /* these two should be handled outside this function */
-       case CHTYPE_TAB:
-       case CHTYPE_NL:
        default:            /* we should never hit the default */
                return 0;
        }



Home | Main Index | Thread Index | Old Index