Module Name:    src
Committed By:   uwe
Date:           Sun Nov 18 22:34:32 UTC 2018

Modified Files:
        src/lib/libcurses: background.c inch.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/lib/libcurses/background.c
cvs rdiff -u -r1.11 -r1.12 src/lib/libcurses/inch.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libcurses/background.c
diff -u src/lib/libcurses/background.c:1.22 src/lib/libcurses/background.c:1.23
--- src/lib/libcurses/background.c:1.22	Sun Nov 18 22:18:02 2018
+++ src/lib/libcurses/background.c	Sun Nov 18 22:34:32 2018
@@ -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 @@ getbkgd(WINDOW *win)
 	/* 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 @@ wgetbkgrnd(WINDOW *win, cchar_t *wch)
 
 	/* 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;

Index: src/lib/libcurses/inch.c
diff -u src/lib/libcurses/inch.c:1.11 src/lib/libcurses/inch.c:1.12
--- src/lib/libcurses/inch.c:1.11	Fri Jan  6 13:53:18 2017
+++ src/lib/libcurses/inch.c	Sun Nov 18 22:34:32 2018
@@ -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 @@ winch(WINDOW *win)
 	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);
 }

Reply via email to