Source-Changes-HG archive

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

[src/trunk]: src/lib/libcurses When we remove default color from attributes, ...



details:   https://anonhg.NetBSD.org/src/rev/7c503af8743c
branches:  trunk
changeset: 445970:7c503af8743c
user:      uwe <uwe%NetBSD.org@localhost>
date:      Sun Nov 18 22:34:32 2018 +0000

description:
When we remove default color from attributes, just clear all __COLOR.
It's both a nono-optmization and matches the test used in counterpart
code that adds default color when none is set.

diffstat:

 lib/libcurses/background.c |  11 +++++------
 lib/libcurses/inch.c       |   6 +++---
 2 files changed, 8 insertions(+), 9 deletions(-)

diffs (65 lines):

diff -r 4ace1cdab37d -r 7c503af8743c lib/libcurses/background.c
--- a/lib/libcurses/background.c        Sun Nov 18 22:18:02 2018 +0000
+++ b/lib/libcurses/background.c        Sun Nov 18 22:34:32 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: background.c,v 1.22 2018/11/18 22:18:02 uwe Exp $      */
+/*     $NetBSD: background.c,v 1.23 2018/11/18 22:34:32 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.22 2018/11/18 22:18:02 uwe Exp $");
+__RCSID("$NetBSD: background.c,v 1.23 2018/11/18 22:34:32 uwe Exp $");
 #endif                         /* not lint */
 
 #include <stdlib.h>
@@ -129,7 +129,7 @@
        /* Background attributes (check colour). */
        battr = win->battr & A_ATTRIBUTES;
        if (__using_color && ((battr & __COLOR) == __default_color))
-               battr &= ~__default_color;
+               battr &= ~__COLOR;
 
        return ((chtype) ((win->bch & A_CHARTEXT) | battr));
 }
@@ -257,9 +257,8 @@
 
        /* Background attributes (check colour). */
        wch->attributes = win->battr & WA_ATTRIBUTES;
-       if (__using_color && ((wch->attributes & __COLOR)
-                       == __default_color))
-               wch->attributes &= ~__default_color;
+       if (__using_color && ((wch->attributes & __COLOR) == __default_color))
+               wch->attributes &= ~__COLOR;
        wch->vals[0] = win->bch;
        wch->elements = 1;
        np = win->bnsp;
diff -r 4ace1cdab37d -r 7c503af8743c lib/libcurses/inch.c
--- a/lib/libcurses/inch.c      Sun Nov 18 22:18:02 2018 +0000
+++ b/lib/libcurses/inch.c      Sun Nov 18 22:34:32 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: inch.c,v 1.11 2017/01/06 13:53:18 roy Exp $    */
+/*     $NetBSD: inch.c,v 1.12 2018/11/18 22:34:32 uwe Exp $    */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: inch.c,v 1.11 2017/01/06 13:53:18 roy Exp $");
+__RCSID("$NetBSD: inch.c,v 1.12 2018/11/18 22:34:32 uwe Exp $");
 #endif                         /* not lint */
 
 #include "curses.h"
@@ -92,6 +92,6 @@
        attr = (attr_t) ((win)->alines[(win)->cury]->line[(win)->curx].attr &
            __ATTRIBUTES);
        if (__using_color && ((attr & __COLOR) == __default_color))
-               attr &= ~__default_color;
+               attr &= ~__COLOR;
        return (ch | attr);
 }



Home | Main Index | Thread Index | Old Index