Source-Changes-HG archive

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

[src/trunk]: src/lib/libcurses Drop HAVE_WCHAR ifdefs from code that is not e...



details:   https://anonhg.NetBSD.org/src/rev/3a3c9b376ba8
branches:  trunk
changeset: 446086:3a3c9b376ba8
user:      uwe <uwe%NetBSD.org@localhost>
date:      Thu Nov 22 22:16:45 2018 +0000

description:
Drop HAVE_WCHAR ifdefs from code that is not even compiled with !HAVE_WCHAR.

We still try to mainain the ability to build our curses with
!HAVE_WCHAR, but it doesn't make sense to provide stubs for new wide
API functions that just error out when !HAVE_WCHAR.  Any code that
only uses old API (and can work with !HAVE_WCHAR curses) doesn't use
those new functions.  The code that uses new API obviosly cannot work
when all the new API is stubbed out.

So the plan is to drop the stubs.  This commit does that for files
that are not even compiled with !HAVE_WCHAR (not only those stubs are
useless, they were not even there to begin with).

Same object code is generated for the normal HAVE_WCHAR case.  Nothing
is even recompiled for !HAVE_WCHAR.

Ok by blymn@ jdc@ roy@

diffstat:

 lib/libcurses/add_wch.c    |  20 ++------------------
 lib/libcurses/add_wchstr.c |  36 ++----------------------------------
 lib/libcurses/addwstr.c    |  36 ++----------------------------------
 lib/libcurses/cchar.c      |  12 ++----------
 lib/libcurses/echo_wchar.c |  16 ++--------------
 lib/libcurses/get_wch.c    |  30 ++----------------------------
 lib/libcurses/get_wstr.c   |  40 ++--------------------------------------
 lib/libcurses/in_wch.c     |  20 ++------------------
 lib/libcurses/in_wchstr.c  |  36 ++----------------------------------
 lib/libcurses/ins_wch.c    |  20 ++------------------
 lib/libcurses/ins_wstr.c   |   8 ++------
 lib/libcurses/inwstr.c     |  36 ++----------------------------------
 12 files changed, 24 insertions(+), 286 deletions(-)

diffs (truncated from 1119 to 300 lines):

diff -r 5506343020dd -r 3a3c9b376ba8 lib/libcurses/add_wch.c
--- a/lib/libcurses/add_wch.c   Thu Nov 22 22:00:49 2018 +0000
+++ b/lib/libcurses/add_wch.c   Thu Nov 22 22:16:45 2018 +0000
@@ -1,4 +1,4 @@
-/*   $NetBSD: add_wch.c,v 1.5 2016/01/07 07:36:35 jdc Exp $ */
+/*   $NetBSD: add_wch.c,v 1.6 2018/11/22 22:16:45 uwe Exp $ */
 
 /*
  * Copyright (c) 2005 The NetBSD Foundation Inc.
@@ -36,7 +36,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: add_wch.c,v 1.5 2016/01/07 07:36:35 jdc Exp $");
+__RCSID("$NetBSD: add_wch.c,v 1.6 2018/11/22 22:16:45 uwe Exp $");
 #endif /* not lint */
 
 #include <stdlib.h>
@@ -54,11 +54,7 @@
 int
 add_wch(const cchar_t *wch)
 {
-#ifndef HAVE_WCHAR
-       return ERR;
-#else
        return wadd_wch(stdscr, wch);
-#endif /* HAVE_WCHAR */
 }
 
 
@@ -69,11 +65,7 @@
 int
 mvadd_wch(int y, int x, const cchar_t *wch)
 {
-#ifndef HAVE_WCHAR
-       return ERR;
-#else
        return mvwadd_wch(stdscr, y, x, wch);
-#endif /* HAVE_WCHAR */
 }
 
 
@@ -84,14 +76,10 @@
 int
 mvwadd_wch(WINDOW *win, int y, int x, const cchar_t *wch)
 {
-#ifndef HAVE_WCHAR
-       return ERR;
-#else
        if (wmove(win, y, x) == ERR)
                return ERR;
 
        return wadd_wch(win, wch);
-#endif /* HAVE_WCHAR */
 }
 
 
@@ -104,9 +92,6 @@
 int
 wadd_wch(WINDOW *win, const cchar_t *wch)
 {
-#ifndef HAVE_WCHAR
-       return ERR;
-#else
        int x = win->curx, y = win->cury;
        __LINE *lnp = NULL;
 
@@ -120,5 +105,4 @@
 #endif
        lnp = win->alines[y];
        return _cursesi_addwchar(win, &lnp, &y, &x, wch, 1);
-#endif /* HAVE_WCHAR */
 }
diff -r 5506343020dd -r 3a3c9b376ba8 lib/libcurses/add_wchstr.c
--- a/lib/libcurses/add_wchstr.c        Thu Nov 22 22:00:49 2018 +0000
+++ b/lib/libcurses/add_wchstr.c        Thu Nov 22 22:16:45 2018 +0000
@@ -1,4 +1,4 @@
-/*   $NetBSD: add_wchstr.c,v 1.5 2016/10/22 21:55:06 christos Exp $ */
+/*   $NetBSD: add_wchstr.c,v 1.6 2018/11/22 22:16:45 uwe Exp $ */
 
 /*
  * Copyright (c) 2005 The NetBSD Foundation Inc.
@@ -36,7 +36,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: add_wchstr.c,v 1.5 2016/10/22 21:55:06 christos Exp $");
+__RCSID("$NetBSD: add_wchstr.c,v 1.6 2018/11/22 22:16:45 uwe Exp $");
 #endif                         /* not lint */
 
 #include <stdlib.h>
@@ -51,11 +51,7 @@
 int
 add_wchstr(const cchar_t *wchstr)
 {
-#ifndef HAVE_WCHAR
-       return ERR;
-#else
        return wadd_wchnstr(stdscr, wchstr, -1);
-#endif
 }
 
 
@@ -66,11 +62,7 @@
 int
 wadd_wchstr(WINDOW *win, const cchar_t *wchstr)
 {
-#ifndef HAVE_WCHAR
-       return ERR;
-#else
        return wadd_wchnstr(win, wchstr, -1);
-#endif
 }
 
 
@@ -82,11 +74,7 @@
 int
 add_wchnstr(const cchar_t *wchstr, int n)
 {
-#ifndef HAVE_WCHAR
-       return ERR;
-#else
        return wadd_wchnstr(stdscr, wchstr, n);
-#endif
 }
 
 
@@ -97,11 +85,7 @@
 int
 mvadd_wchstr(int y, int x, const cchar_t *wchstr)
 {
-#ifndef HAVE_WCHAR
-       return ERR;
-#else
        return mvwadd_wchnstr(stdscr, y, x, wchstr, -1);
-#endif
 }
 
 
@@ -112,11 +96,7 @@
 int
 mvwadd_wchstr(WINDOW *win, int y, int x, const cchar_t *wchstr)
 {
-#ifndef HAVE_WCHAR
-       return ERR;
-#else
        return mvwadd_wchnstr(win, y, x, wchstr, -1);
-#endif
 }
 
 
@@ -128,11 +108,7 @@
 int
 mvadd_wchnstr(int y, int x, const cchar_t *wchstr, int n)
 {
-#ifndef HAVE_WCHAR
-       return ERR;
-#else
        return mvwadd_wchnstr(stdscr, y, x, wchstr, n);
-#endif
 }
 
 
@@ -144,14 +120,10 @@
 int
 mvwadd_wchnstr(WINDOW *win, int y, int x, const cchar_t *wchstr, int n)
 {
-#ifndef HAVE_WCHAR
-       return ERR;
-#else
        if (wmove(win, y, x) == ERR)
                return ERR;
 
        return wadd_wchnstr(win, wchstr, n);
-#endif
 }
 
 
@@ -163,9 +135,6 @@
 int
 wadd_wchnstr(WINDOW *win, const cchar_t *wchstr, int n)
 {
-#ifndef HAVE_WCHAR
-       return ERR;
-#else
        const cchar_t *chp;
        wchar_t wc;
        int cw, x, y, sx, ex, newx, i, cnt;
@@ -334,5 +303,4 @@
        __touchline(win, y, sx, ex);
 
        return OK;
-#endif /* HAVE_WCHAR */
 }
diff -r 5506343020dd -r 3a3c9b376ba8 lib/libcurses/addwstr.c
--- a/lib/libcurses/addwstr.c   Thu Nov 22 22:00:49 2018 +0000
+++ b/lib/libcurses/addwstr.c   Thu Nov 22 22:16:45 2018 +0000
@@ -1,4 +1,4 @@
-/*   $NetBSD: addwstr.c,v 1.3 2017/01/06 13:53:18 roy Exp $ */
+/*   $NetBSD: addwstr.c,v 1.4 2018/11/22 22:16:45 uwe Exp $ */
 
 /*
  * Copyright (c) 2005 The NetBSD Foundation Inc.
@@ -36,7 +36,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: addwstr.c,v 1.3 2017/01/06 13:53:18 roy Exp $");
+__RCSID("$NetBSD: addwstr.c,v 1.4 2018/11/22 22:16:45 uwe Exp $");
 #endif                                           /* not lint */
 
 #include <string.h>
@@ -51,11 +51,7 @@
 int
 addwstr(const wchar_t *s)
 {
-#ifndef HAVE_WCHAR
-       return ERR;
-#else
        return waddnwstr(stdscr, s, -1);
-#endif /* HAVE_WCHAR */
 }
 
 /*
@@ -65,11 +61,7 @@
 int
 waddwstr(WINDOW *win, const wchar_t *s)
 {
-#ifndef HAVE_WCHAR
-       return ERR;
-#else
        return waddnwstr(win, s, -1);
-#endif /* HAVE_WCHAR */
 }
 
 /*
@@ -80,11 +72,7 @@
 int
 addnwstr(const wchar_t *str, int n)
 {
-#ifndef HAVE_WCHAR
-       return ERR;
-#else
        return waddnwstr(stdscr, str, n);
-#endif /* HAVE_WCHAR */
 }
 
 /*
@@ -94,11 +82,7 @@
 int
 mvaddwstr(int y, int x, const wchar_t *str)
 {
-#ifndef HAVE_WCHAR
-       return ERR;
-#else
        return mvwaddnwstr(stdscr, y, x, str, -1);
-#endif /* HAVE_WCHAR */
 }
 
 /*
@@ -108,11 +92,7 @@
 int
 mvwaddwstr(WINDOW *win, int y, int x, const wchar_t *str)
 {
-#ifndef HAVE_WCHAR
-       return ERR;
-#else
        return mvwaddnwstr(win, y, x, str, -1);
-#endif /* HAVE_WCHAR */
 }
 
 /*
@@ -123,11 +103,7 @@
 int
 mvaddnwstr(int y, int x, const wchar_t *str, int count)
 {
-#ifndef HAVE_WCHAR
-       return ERR;
-#else
        return mvwaddnwstr(stdscr, y, x, str, count);
-#endif /* HAVE_WCHAR */
 }
 
 /*
@@ -138,14 +114,10 @@
 int
 mvwaddnwstr(WINDOW *win, int y, int x, const wchar_t *str, int count)
 {
-#ifndef HAVE_WCHAR
-       return ERR;
-#else
        if (wmove(win, y, x) == ERR)
                return ERR;
 
        return waddnwstr(win, str, count);
-#endif /* HAVE_WCHAR */
 }
 
 /*
@@ -157,9 +129,6 @@



Home | Main Index | Thread Index | Old Index