Reduced codesize by replacing if/else constructs with boolean parameters.
diff --git a/contiki/ctk/ctk-conio-service.c b/contiki/ctk/ctk-conio-service.c
index b92e78e..0f49eaf 100644
--- a/contiki/ctk/ctk-conio-service.c
+++ b/contiki/ctk/ctk-conio-service.c
@@ -29,7 +29,7 @@
*
* This file is part of the "ctk" console GUI toolkit for cc65
*
- * $Id: ctk-conio-service.c,v 1.8 2005/03/29 20:30:32 oliverschmidt Exp $
+ * $Id: ctk-conio-service.c,v 1.9 2005/05/04 19:54:50 oliverschmidt Exp $
*
*/
@@ -135,11 +135,7 @@
break;
case CTK_WIDGET_BUTTON:
if(ypos >= clipy1 && ypos < clipy2) {
- if(wfocus != 0) {
- revers(1);
- } else {
- revers(0);
- }
+ revers(wfocus != 0);
cputcxy(xpos, ypos, '[');
cputsn(w->widget.button.text, w->w);
cputc(']');
@@ -148,11 +144,7 @@
break;
case CTK_WIDGET_HYPERLINK:
if(ypos >= clipy1 && ypos < clipy2) {
- if(wfocus != 0) {
- revers(0);
- } else {
- revers(1);
- }
+ revers(wfocus == 0);
gotoxy(xpos, ypos);
(void)textcolor(WIDGETCOLOR_HLINK);
cputsn(w->widget.button.text, w->w);
@@ -161,11 +153,7 @@
break;
case CTK_WIDGET_TEXTENTRY:
text = w->widget.textentry.text;
- if(wfocus != 0) {
- revers(1);
- } else {
- revers(0);
- }
+ revers(wfocus != 0);
xscroll = 0;
if(w->widget.textentry.xpos >= w->w - 1) {
xscroll = w->widget.textentry.xpos - w->w + 1;
@@ -178,11 +166,7 @@
cputcxy(xpos, ypos, '>');
for(i = 0; i < w->w; ++i) {
c = text[i + xscroll];
- if(i == w->widget.textentry.xpos - xscroll) {
- revers(1);
- } else {
- revers(0);
- }
+ revers(i == w->widget.textentry.xpos - xscroll);
if(c == 0) {
cputc(' ');
} else {
@@ -209,11 +193,7 @@
break;
case CTK_WIDGET_ICON:
if(ypos >= clipy1 && ypos < clipy2) {
- if(focus & 1) {
- revers(1);
- } else {
- revers(0);
- }
+ revers(wfocus != 0);
gotoxy(xpos, ypos);
if(w->widget.icon.textmap != NULL) {
for(i = 0; i < 3; ++i) {