Source-Changes-HG archive

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

[src/trunk]: src/lib/libedit Since Width() is used only for display purposes ...



details:   https://anonhg.NetBSD.org/src/rev/6476b3cfc9a3
branches:  trunk
changeset: 771240:6476b3cfc9a3
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Nov 15 23:54:14 2011 +0000

description:
Since Width() is used only for display purposes we don't want to pass -1 for
unprintable characters.

diffstat:

 lib/libedit/chartype.h |  9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diffs (23 lines):

diff -r a297f3a72516 -r 6476b3cfc9a3 lib/libedit/chartype.h
--- a/lib/libedit/chartype.h    Tue Nov 15 22:55:28 2011 +0000
+++ b/lib/libedit/chartype.h    Tue Nov 15 23:54:14 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: chartype.h,v 1.8 2011/07/29 23:44:44 christos Exp $    */
+/*     $NetBSD: chartype.h,v 1.9 2011/11/15 23:54:14 christos Exp $    */
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -105,7 +105,12 @@
 
 #define Strtol(p,e,b)   wcstol(p,e,b)
 
-#define Width(c)       wcwidth(c)
+static inline size_t
+Width(wchar_t c)
+{
+       int w = wcwidth(c);
+       return (w < 0) ? 0 : (size_t)w;
+}
 
 #else /* NARROW */
 



Home | Main Index | Thread Index | Old Index