summaryrefslogtreecommitdiff
path: root/lib/libedit/parse.c
diff options
context:
space:
mode:
authorchristos <christos@NetBSD.org>2016-02-14 14:49:34 +0000
committerchristos <christos@NetBSD.org>2016-02-14 14:49:34 +0000
commit3117a22c97d0dc4bf12da418d5034ec33dc02e38 (patch)
treefb568a9ff69b413e095a15cbe3663db14428f389 /lib/libedit/parse.c
parent833b39ead90606d46a6f47ff8422f193f116f752 (diff)
From Ingo Schwarze:
As we have seen before, "histedit.h" can never get rid of including the <wchar.h> header because using the data types defined there is deeply ingrained in the public interfaces of libedit. Now POSIX unconditionally requires that <wchar.h> defines the type wint_t. Consequently, it can be used unconditionally, no matter whether WIDECHAR is active or not. Consequently, the #define Int is pointless. Note that removing it is not gratuitious churn. Auditing for integer signedness problems is already hard when only fundamental types like "int" and "unsigned" are involved. It gets very hard when types come into the picture that have platform-dependent signedness, like "char" and "wint_t". Adding yet another layer on top, changing both the signedness and the width in a platform- dependent way, makes auditing yet harder, which IMHO is really dangerous. Note that while removing the #define, i already found one bug caused by this excessive complication - in the function re_putc() in refresh.c. If WIDECHAR was defined, it printed an Int = wint_t value with %c. Fortunately, that bug only affects debugging, not production. The fix is contained in the patch. With WIDECHAR, this doesn't change anything. For the case without WIDECHAR, i checked that none of the places wants to store values that might not fit in wint_t. This only changes internal interfaces; public ones remain unchanged.
Diffstat (limited to 'lib/libedit/parse.c')
-rw-r--r--lib/libedit/parse.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/libedit/parse.c b/lib/libedit/parse.c
index c814ef28907..5058b61869b 100644
--- a/lib/libedit/parse.c
+++ b/lib/libedit/parse.c
@@ -1,4 +1,4 @@
-/* $NetBSD: parse.c,v 1.28 2016/02/11 19:21:04 christos Exp $ */
+/* $NetBSD: parse.c,v 1.29 2016/02/14 14:49:34 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)parse.c 8.1 (Berkeley) 6/4/93";
#else
-__RCSID("$NetBSD: parse.c,v 1.28 2016/02/11 19:21:04 christos Exp $");
+__RCSID("$NetBSD: parse.c,v 1.29 2016/02/14 14:49:34 christos Exp $");
#endif
#endif /* not lint && not SCCSID */
@@ -139,7 +139,7 @@ protected int
parse__escape(const Char **ptr)
{
const Char *p;
- Int c;
+ wint_t c;
p = *ptr;