Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libcurses Don't fuse HAVE_WCHAR and (trivial) !HAVE_WCHA...
details: https://anonhg.NetBSD.org/src/rev/94d512021212
branches: trunk
changeset: 994705:94d512021212
user: uwe <uwe%NetBSD.org@localhost>
date: Sun Nov 18 22:11:38 2018 +0000
description:
Don't fuse HAVE_WCHAR and (trivial) !HAVE_WCHAR bodies into single
function definition. Instead provide two sets of definitions under
single #ifdef. Same object code is generated for both HAVE_WCHAR and
!HAVE_WCHAR.
diffstat:
lib/libcurses/background.c | 106 ++++++++++++++++++++++++++++++--------------
1 files changed, 71 insertions(+), 35 deletions(-)
diffs (161 lines):
diff -r a36127efd2da -r 94d512021212 lib/libcurses/background.c
--- a/lib/libcurses/background.c Sun Nov 18 21:01:16 2018 +0000
+++ b/lib/libcurses/background.c Sun Nov 18 22:11:38 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: background.c,v 1.20 2018/11/18 21:01:16 uwe Exp $ */
+/* $NetBSD: background.c,v 1.21 2018/11/18 22:11:38 uwe Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: background.c,v 1.20 2018/11/18 21:01:16 uwe Exp $");
+__RCSID("$NetBSD: background.c,v 1.21 2018/11/18 22:11:38 uwe Exp $");
#endif /* not lint */
#include <stdlib.h>
@@ -134,39 +134,34 @@
return ((chtype) ((win->bch & A_CHARTEXT) | battr));
}
-int bkgrnd(const cchar_t *wch)
+
+#ifdef HAVE_WCHAR
+
+int
+bkgrnd(const cchar_t *wch)
{
-#ifndef HAVE_WCHAR
- return ERR;
-#else
return wbkgrnd( stdscr, wch );
-#endif /* HAVE_WCHAR */
-}
-
-void bkgrndset(const cchar_t *wch)
-{
-#ifdef HAVE_WCHAR
- wbkgrndset( stdscr, wch );
-#endif /* HAVE_WCHAR */
}
-int getbkgrnd(cchar_t *wch)
+
+void
+bkgrndset(const cchar_t *wch)
{
-#ifndef HAVE_WCHAR
- return ERR;
-#else
- return wgetbkgrnd( stdscr, wch );
-#endif /* HAVE_WCHAR */
+ wbkgrndset( stdscr, wch );
}
-int wbkgrnd(WINDOW *win, const cchar_t *wch)
+
+int
+getbkgrnd(cchar_t *wch)
{
-#ifndef HAVE_WCHAR
- return ERR;
-#else
-/* int y, x, i; */
+ return wgetbkgrnd( stdscr, wch );
+}
+
+
+int
+wbkgrnd(WINDOW *win, const cchar_t *wch)
+{
attr_t battr;
-/* nschar_t *np, *tnp, *pnp; */
#ifdef DEBUG
__CTRACE(__CTRACE_ATTR, "wbkgrnd: (%p), '%s', %x\n",
@@ -186,12 +181,12 @@
wbkgrndset(win, wch);
__touchwin(win);
return OK;
-#endif /* HAVE_WCHAR */
}
-void wbkgrndset(WINDOW *win, const cchar_t *wch)
+
+void
+wbkgrndset(WINDOW *win, const cchar_t *wch)
{
-#ifdef HAVE_WCHAR
attr_t battr;
nschar_t *np, *tnp;
int i;
@@ -252,14 +247,12 @@
battr |= __default_color;
win->battr = battr;
SET_BGWCOL((*win), 1);
-#endif /* HAVE_WCHAR */
}
-int wgetbkgrnd(WINDOW *win, cchar_t *wch)
+
+int
+wgetbkgrnd(WINDOW *win, cchar_t *wch)
{
-#ifndef HAVE_WCHAR
- return ERR;
-#else
nschar_t *np;
/* Background attributes (check colour). */
@@ -278,5 +271,48 @@
}
return OK;
-#endif /* HAVE_WCHAR */
+}
+
+#else /* !HAVE_WCHAR */
+
+int
+bkgrnd(const cchar_t *wch)
+{
+ return ERR;
+}
+
+
+void
+bkgrndset(const cchar_t *wch)
+{
+ return;
+}
+
+int
+getbkgrnd(cchar_t *wch)
+{
+ return ERR;
}
+
+
+int
+wbkgrnd(WINDOW *win, const cchar_t *wch)
+{
+ return ERR;
+}
+
+
+void
+wbkgrndset(WINDOW *win, const cchar_t *wch)
+{
+ return;
+}
+
+
+int
+wgetbkgrnd(WINDOW *win, cchar_t *wch)
+{
+ return ERR;
+}
+
+#endif /* !HAVE_WCHAR */
Home |
Main Index |
Thread Index |
Old Index