Source-Changes-HG archive

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

[src/trunk]: src/lib/libcurses Expand __CTRACE() to __nothing #ifndef DEBUG.



details:   https://anonhg.NetBSD.org/src/rev/fb3e81cb78ed
branches:  trunk
changeset: 985751:fb3e81cb78ed
user:      rin <rin%NetBSD.org@localhost>
date:      Mon Sep 06 07:03:49 2021 +0000

description:
Expand __CTRACE() to __nothing #ifndef DEBUG.

Remove most of #ifdef DEBUG around __CTRACE() calls.

No binary changes, except for line numbers for assert().

diffstat:

 lib/libcurses/acs.c            |  14 +------
 lib/libcurses/add_wchstr.c     |  16 +-------
 lib/libcurses/addch.c          |   8 +---
 lib/libcurses/addchnstr.c      |   6 +--
 lib/libcurses/addnstr.c        |   6 +--
 lib/libcurses/addwstr.c        |   8 +---
 lib/libcurses/attributes.c     |  28 +--------------
 lib/libcurses/background.c     |  12 +-----
 lib/libcurses/bell.c           |  12 +-----
 lib/libcurses/border.c         |  12 +-----
 lib/libcurses/chgat.c          |   6 +--
 lib/libcurses/clrtoeol.c       |   6 +--
 lib/libcurses/color.c          |  22 +----------
 lib/libcurses/copywin.c        |  12 +-----
 lib/libcurses/cr_put.c         |  16 +-------
 lib/libcurses/curs_set.c       |  10 +----
 lib/libcurses/curses_private.h |   4 +-
 lib/libcurses/delwin.c         |   6 +--
 lib/libcurses/erase.c          |   6 +--
 lib/libcurses/fileio.c         |  10 +----
 lib/libcurses/get_wch.c        |  62 +--------------------------------
 lib/libcurses/get_wstr.c       |   6 +--
 lib/libcurses/getch.c          |  38 +-------------------
 lib/libcurses/getstr.c         |   6 +--
 lib/libcurses/initscr.c        |   6 +--
 lib/libcurses/ins_wch.c        |  14 +------
 lib/libcurses/ins_wstr.c       |  18 +--------
 lib/libcurses/insdelln.c       |   6 +--
 lib/libcurses/insstr.c         |   8 +---
 lib/libcurses/keypad.c         |   6 +--
 lib/libcurses/line.c           |  12 +-----
 lib/libcurses/meta.c           |   8 +---
 lib/libcurses/move.c           |   6 +--
 lib/libcurses/mvwin.c          |   6 +--
 lib/libcurses/newwin.c         |  18 +--------
 lib/libcurses/overlay.c        |   6 +--
 lib/libcurses/overwrite.c      |   6 +--
 lib/libcurses/pause.c          |   8 +---
 lib/libcurses/putchar.c        |  12 +-----
 lib/libcurses/refresh.c        |  78 +----------------------------------------
 lib/libcurses/resize.c         |  14 +------
 lib/libcurses/ripoffline.c     |   6 +--
 lib/libcurses/screen.c         |  12 +-----
 lib/libcurses/scroll.c         |  10 +----
 lib/libcurses/setterm.c        |  14 +------
 lib/libcurses/slk.c            |  14 +------
 lib/libcurses/toucholap.c      |   8 +---
 lib/libcurses/touchwin.c       |  26 +------------
 lib/libcurses/tscroll.c        |  24 +-----------
 lib/libcurses/tstp.c           |  20 +---------
 lib/libcurses/tty.c            |  30 +---------------
 lib/libcurses/underscore.c     |   8 +---
 52 files changed, 106 insertions(+), 630 deletions(-)

diffs (truncated from 3722 to 300 lines):

diff -r a7aba75e25b8 -r fb3e81cb78ed lib/libcurses/acs.c
--- a/lib/libcurses/acs.c       Mon Sep 06 02:50:43 2021 +0000
+++ b/lib/libcurses/acs.c       Mon Sep 06 07:03:49 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: acs.c,v 1.21 2017/01/06 13:53:18 roy Exp $     */
+/*     $NetBSD: acs.c,v 1.22 2021/09/06 07:03:49 rin Exp $     */
 
 /*
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: acs.c,v 1.21 2017/01/06 13:53:18 roy Exp $");
+__RCSID("$NetBSD: acs.c,v 1.22 2021/09/06 07:03:49 rin Exp $");
 #endif                         /* not lint */
 
 #include "curses.h"
@@ -112,9 +112,7 @@
                if (acs < NUM_ACS)
                        _acs_char[acs] = term | __ALTCHARSET;
                aofac++;
-#ifdef DEBUG
                __CTRACE(__CTRACE_INIT, "__init_acs: %c = %c\n", acs, term);
-#endif
        }
 
        if (t_ena_acs(screen->term) != NULL)
@@ -162,9 +160,7 @@
        lstr = nl_langinfo(CODESET);
        _DIAGASSERT(lstr);
        if (strcasecmp(lstr, "UTF-8")) {
-#ifdef DEBUG
                __CTRACE(__CTRACE_INIT, "__init_wacs: setting defaults\n" );
-#endif /* DEBUG */
                WACS_RARROW->vals[0]  = ( wchar_t )btowc( '>' );
                WACS_LARROW->vals[0]  = ( wchar_t )btowc( '<' );
                WACS_UARROW->vals[0]  = ( wchar_t )btowc( '^' );
@@ -189,10 +185,8 @@
                WACS_STERLING->vals[0]= ( wchar_t )btowc( '}' );
        } else {
                /* Unicode defaults */
-#ifdef DEBUG
                __CTRACE(__CTRACE_INIT,
                    "__init_wacs: setting Unicode defaults\n" );
-#endif /* DEBUG */
                WACS_RARROW->vals[0]  = 0x2192;
                ACS_RARROW = '+' | __ACS_IS_WACS;
                WACS_LARROW->vals[0]  = 0x2190;
@@ -260,10 +254,8 @@
        }
 
        if (t_acs_chars(screen->term) == NULL) {
-#ifdef DEBUG
                __CTRACE(__CTRACE_INIT,
                    "__init_wacs: no alternative characters\n" );
-#endif /* DEBUG */
                goto out;
        }
 
@@ -280,9 +272,7 @@
                        _wacs_char[acs].attributes |= WA_ALTCHARSET;
                }
                aofac++;
-#ifdef DEBUG
                __CTRACE(__CTRACE_INIT, "__init_wacs: %c = %c\n", acs, term);
-#endif
        }
 
        if (t_ena_acs(screen->term) != NULL)
diff -r a7aba75e25b8 -r fb3e81cb78ed lib/libcurses/add_wchstr.c
--- a/lib/libcurses/add_wchstr.c        Mon Sep 06 02:50:43 2021 +0000
+++ b/lib/libcurses/add_wchstr.c        Mon Sep 06 07:03:49 2021 +0000
@@ -1,4 +1,4 @@
-/*   $NetBSD: add_wchstr.c,v 1.8 2019/06/09 07:40:14 blymn Exp $ */
+/*   $NetBSD: add_wchstr.c,v 1.9 2021/09/06 07:03:49 rin 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.8 2019/06/09 07:40:14 blymn Exp $");
+__RCSID("$NetBSD: add_wchstr.c,v 1.9 2021/09/06 07:03:49 rin Exp $");
 #endif                         /* not lint */
 
 #include <stdlib.h>
@@ -142,10 +142,8 @@
        nschar_t *np, *tnp;
        __LINE *lnp;
 
-#ifdef DEBUG
        __CTRACE(__CTRACE_INPUT,
            "wadd_wchnstr: win = %p, wchstr = %p, n = %d\n", win, wchstr, n);
-#endif
 
        if (!wchstr)
                return OK;
@@ -158,9 +156,7 @@
                        n--, chp++, ++cnt);
        else
                for (chp = wchstr, cnt = 0; chp->vals[0]; chp++, ++cnt);
-#ifdef DEBUG
        __CTRACE(__CTRACE_INPUT, "wadd_wchnstr: len=%d\n", cnt);
-#endif /* DEBUG */
        chp = wchstr;
        x = win->curx;
        y = win->cury;
@@ -198,18 +194,14 @@
        while (cnt) {
                x = ex;
                wc = chp->vals[0];
-#ifdef DEBUG
                __CTRACE(__CTRACE_INPUT, "wadd_wchnstr: adding %x", wc);
-#endif /* DEBUG */
                cw = wcwidth(wc);
                if (cw < 0)
                        cw = 1;
                if (cw) {
                        /* spacing character */
-#ifdef DEBUG
                        __CTRACE(__CTRACE_INPUT,
                            " as a spacing char(width=%d)\n", cw);
-#endif /* DEBUG */
                        if (cw > win->maxx - ex) {
                                /* clear to EOL */
                                while (ex < win->maxx) {
@@ -251,11 +243,9 @@
                                }
                        }
                        lp++, ex++;
-#ifdef DEBUG
                        __CTRACE(__CTRACE_INPUT,
                                "wadd_wchnstr: ex = %d, x = %d, cw = %d\n",
                                 ex, x, cw);
-#endif /* DEBUG */
                        while (ex - x <= cw - 1) {
                                np = lp->nsp;
                                if (np) {
@@ -273,10 +263,8 @@
                        }
                } else {
                        /* non-spacing character */
-#ifdef DEBUG
                        __CTRACE(__CTRACE_INPUT,
                                "wadd_wchnstr: as non-spacing char");
-#endif /* DEBUG */
                        for (i = 0; i < chp->elements; i++) {
                                np = malloc(sizeof(nschar_t));
                                if (!np)
diff -r a7aba75e25b8 -r fb3e81cb78ed lib/libcurses/addch.c
--- a/lib/libcurses/addch.c     Mon Sep 06 02:50:43 2021 +0000
+++ b/lib/libcurses/addch.c     Mon Sep 06 07:03:49 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: addch.c,v 1.21 2019/06/09 07:40:14 blymn Exp $ */
+/*     $NetBSD: addch.c,v 1.22 2021/09/06 07:03:49 rin Exp $   */
 
 /*
  * Copyright (c) 1981, 1993, 1994
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)addch.c    8.2 (Berkeley) 5/4/94";
 #else
-__RCSID("$NetBSD: addch.c,v 1.21 2019/06/09 07:40:14 blymn Exp $");
+__RCSID("$NetBSD: addch.c,v 1.22 2021/09/06 07:03:49 rin Exp $");
 #endif
 #endif                         /* not lint */
 
@@ -93,11 +93,9 @@
        cchar_t cc;
 
        __cursesi_chtype_to_cchar(ch, &cc);
-#ifdef DEBUG
        __CTRACE(__CTRACE_INPUT,
                 "addch: %d : 0x%x (adding char as wide char)\n",
                 cc.vals[0], cc.attributes);
-#endif
 
        return wadd_wch(win, &cc);
 }
@@ -115,9 +113,7 @@
 
        buf.ch = (wchar_t)ch & __CHARTEXT;
        buf.attr = (attr_t)ch & __ATTRIBUTES;
-#ifdef DEBUG
        __CTRACE(__CTRACE_INPUT, "addch: %d : 0x%x\n", buf.ch, buf.attr);
-#endif
        return __waddch(win, &buf);
 }
 #endif /* !HAVE_WCHAR */
diff -r a7aba75e25b8 -r fb3e81cb78ed lib/libcurses/addchnstr.c
--- a/lib/libcurses/addchnstr.c Mon Sep 06 02:50:43 2021 +0000
+++ b/lib/libcurses/addchnstr.c Mon Sep 06 07:03:49 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: addchnstr.c,v 1.8 2019/06/09 07:40:14 blymn Exp $      */
+/*     $NetBSD: addchnstr.c,v 1.9 2021/09/06 07:03:49 rin Exp $        */
 
 /*
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: addchnstr.c,v 1.8 2019/06/09 07:40:14 blymn Exp $");
+__RCSID("$NetBSD: addchnstr.c,v 1.9 2021/09/06 07:03:49 rin Exp $");
 #endif                         /* not lint */
 
 #include <stdlib.h>
@@ -137,10 +137,8 @@
        char    *ocp, *cp, *start;
        int i, ret, ox, oy;
 
-#ifdef DEBUG
        __CTRACE(__CTRACE_INPUT, "waddchnstr: win = %p, chstr = %p, n = %d\n",
            win, chstr, n);
-#endif
 
        if (n >= 0)
                for (chp = chstr, len = 0; n-- && *chp++; ++len);
diff -r a7aba75e25b8 -r fb3e81cb78ed lib/libcurses/addnstr.c
--- a/lib/libcurses/addnstr.c   Mon Sep 06 02:50:43 2021 +0000
+++ b/lib/libcurses/addnstr.c   Mon Sep 06 07:03:49 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: addnstr.c,v 1.17 2019/06/09 07:40:14 blymn Exp $       */
+/*     $NetBSD: addnstr.c,v 1.18 2021/09/06 07:03:49 rin Exp $ */
 
 /*
  * Copyright (c) 1993, 1994
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)addnstr.c  8.2 (Berkeley) 5/4/94";
 #else
-__RCSID("$NetBSD: addnstr.c,v 1.17 2019/06/09 07:40:14 blymn Exp $");
+__RCSID("$NetBSD: addnstr.c,v 1.18 2021/09/06 07:03:49 rin Exp $");
 #endif
 #endif                         /* not lint */
 
@@ -135,10 +135,8 @@
        size_t  len;
        const char *p;
 
-#ifdef DEBUG
                __CTRACE(__CTRACE_INPUT, "ADDNSTR: win %p, length %d\n",
                         win, n);
-#endif
        /*
         * behavior changed from traditional BSD curses, for better XCURSES
         * conformance.
diff -r a7aba75e25b8 -r fb3e81cb78ed lib/libcurses/addwstr.c
--- a/lib/libcurses/addwstr.c   Mon Sep 06 02:50:43 2021 +0000
+++ b/lib/libcurses/addwstr.c   Mon Sep 06 07:03:49 2021 +0000
@@ -1,4 +1,4 @@
-/*   $NetBSD: addwstr.c,v 1.6 2019/06/09 07:40:14 blymn Exp $ */
+/*   $NetBSD: addwstr.c,v 1.7 2021/09/06 07:03:49 rin Exp $ */
 
 /*
  * Copyright (c) 2005 The NetBSD Foundation Inc.
@@ -36,7 +36,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: addwstr.c,v 1.6 2019/06/09 07:40:14 blymn Exp $");
+__RCSID("$NetBSD: addwstr.c,v 1.7 2021/09/06 07:03:49 rin Exp $");
 #endif                                           /* not lint */
 
 #include <string.h>
@@ -146,9 +146,7 @@
                for (p = s, len = 0; n-- && *p++; ++len);
        else
                len = wcslen(s);
-#ifdef DEBUG
        __CTRACE(__CTRACE_INPUT, "waddnwstr: string len=%ld\n", (long) len);
-#endif /* DEBUG */
 
        p = s;
        while (len) {
@@ -158,10 +156,8 @@
                        return ERR;
                if (wadd_wch( win, &cc ) == ERR)
                        return ERR;
-#ifdef DEBUG
                __CTRACE(__CTRACE_INPUT, "waddnwstr: (%x,%x,%d) added\n",
                         cc.vals[ 0 ], cc.attributes, cc.elements );
-#endif /* DEBUG */
                p++, len--;
        }
 
diff -r a7aba75e25b8 -r fb3e81cb78ed lib/libcurses/attributes.c
--- a/lib/libcurses/attributes.c        Mon Sep 06 02:50:43 2021 +0000
+++ b/lib/libcurses/attributes.c        Mon Sep 06 07:03:49 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: attributes.c,v 1.31 2019/07/25 20:18:50 uwe Exp $      */
+/*     $NetBSD: attributes.c,v 1.32 2021/09/06 07:03:49 rin Exp $      */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>



Home | Main Index | Thread Index | Old Index