Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libcurses KNF.
details: https://anonhg.NetBSD.org/src/rev/83b51feabf67
branches: trunk
changeset: 350154:83b51feabf67
user: roy <roy%NetBSD.org@localhost>
date: Fri Jan 06 13:53:18 2017 +0000
description:
KNF.
Normalise coding style.
White space police.
Sprinkle some extra braces to make the flow more clear.
No functional changes.
diffstat:
lib/libcurses/acs.c | 26 +-
lib/libcurses/addnstr.c | 10 +-
lib/libcurses/addwstr.c | 24 +-
lib/libcurses/attributes.c | 10 +-
lib/libcurses/background.c | 40 ++--
lib/libcurses/bell.c | 8 +-
lib/libcurses/border.c | 302 +++++++++++++++++++++-----------------------
lib/libcurses/box.c | 9 +-
lib/libcurses/cchar.c | 20 +-
lib/libcurses/clrtobot.c | 14 +-
lib/libcurses/clrtoeol.c | 16 +-
lib/libcurses/color.c | 63 ++++----
lib/libcurses/copywin.c | 5 +-
lib/libcurses/cr_put.c | 32 ++--
lib/libcurses/ctrace.c | 18 +-
lib/libcurses/delch.c | 34 ++--
lib/libcurses/deleteln.c | 8 +-
lib/libcurses/delwin.c | 8 +-
lib/libcurses/erase.c | 6 +-
lib/libcurses/flushok.c | 6 +-
lib/libcurses/fullname.c | 6 +-
lib/libcurses/get_wch.c | 104 ++++++++-------
lib/libcurses/get_wstr.c | 18 +-
lib/libcurses/getch.c | 22 +-
lib/libcurses/getstr.c | 12 +-
lib/libcurses/getyx.c | 28 ++-
lib/libcurses/idcok.c | 6 +-
lib/libcurses/idlok.c | 6 +-
lib/libcurses/immedok.c | 6 +-
lib/libcurses/in_wch.c | 16 +-
lib/libcurses/in_wchstr.c | 16 +-
lib/libcurses/inch.c | 7 +-
lib/libcurses/inchstr.c | 10 +-
lib/libcurses/initscr.c | 6 +-
lib/libcurses/ins_wch.c | 62 ++++----
lib/libcurses/insch.c | 18 +-
lib/libcurses/insdelln.c | 27 ++-
lib/libcurses/insertln.c | 10 +-
lib/libcurses/insstr.c | 44 +++--
lib/libcurses/inwstr.c | 10 +-
lib/libcurses/keyname.c | 7 +-
lib/libcurses/keypad.c | 6 +-
lib/libcurses/leaveok.c | 6 +-
lib/libcurses/line.c | 26 ++-
lib/libcurses/meta.c | 6 +-
lib/libcurses/move.c | 13 +-
lib/libcurses/mvwin.c | 8 +-
lib/libcurses/newwin.c | 39 +++--
lib/libcurses/nodelay.c | 7 +-
lib/libcurses/notimeout.c | 5 +-
lib/libcurses/pause.c | 16 +-
lib/libcurses/printw.c | 18 +-
lib/libcurses/putchar.c | 12 +-
lib/libcurses/refresh.c | 194 ++++++++++++++++------------
lib/libcurses/resize.c | 11 +-
lib/libcurses/scanw.c | 21 +-
lib/libcurses/screen.c | 8 +-
lib/libcurses/scroll.c | 28 ++-
lib/libcurses/scrollok.c | 7 +-
lib/libcurses/setterm.c | 19 +-
lib/libcurses/standout.c | 12 +-
lib/libcurses/syncok.c | 7 +-
lib/libcurses/timeout.c | 5 +-
lib/libcurses/toucholap.c | 8 +-
lib/libcurses/touchwin.c | 14 +-
lib/libcurses/tscroll.c | 37 ++--
lib/libcurses/tstp.c | 80 ++++++-----
lib/libcurses/tty.c | 34 +++-
lib/libcurses/underscore.c | 10 +-
69 files changed, 925 insertions(+), 832 deletions(-)
diffs (truncated from 5640 to 300 lines):
diff -r 27a2f0aa88af -r 83b51feabf67 lib/libcurses/acs.c
--- a/lib/libcurses/acs.c Fri Jan 06 09:32:08 2017 +0000
+++ b/lib/libcurses/acs.c Fri Jan 06 13:53:18 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acs.c,v 1.20 2012/04/21 12:27:27 roy Exp $ */
+/* $NetBSD: acs.c,v 1.21 2017/01/06 13:53:18 roy Exp $ */
/*
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: acs.c,v 1.20 2012/04/21 12:27:27 roy Exp $");
+__RCSID("$NetBSD: acs.c,v 1.21 2017/01/06 13:53:18 roy Exp $");
#endif /* not lint */
#include "curses.h"
@@ -203,7 +203,7 @@
ACS_DARROW = '.' | __ACS_IS_WACS;
WACS_BLOCK->vals[0] = 0x25ae;
ACS_BLOCK = '0' | __ACS_IS_WACS;
- WACS_DIAMOND->vals[0] = 0x25c6;
+ WACS_DIAMOND->vals[0] = 0x25c6;
ACS_DIAMOND = '`' | __ACS_IS_WACS;
WACS_CKBOARD->vals[0] = 0x2592;
ACS_CKBOARD = 'a' | __ACS_IS_WACS;
@@ -215,15 +215,15 @@
ACS_BOARD = 'h' | __ACS_IS_WACS;
WACS_LANTERN->vals[0] = 0x2603;
ACS_LANTERN = 'i' | __ACS_IS_WACS;
- WACS_LRCORNER->vals[0]= 0x2518;
+ WACS_LRCORNER->vals[0]= 0x2518;
ACS_LRCORNER = 'j' | __ACS_IS_WACS;
- WACS_URCORNER->vals[0]= 0x2510;
+ WACS_URCORNER->vals[0]= 0x2510;
ACS_URCORNER = 'k' | __ACS_IS_WACS;
- WACS_ULCORNER->vals[0]= 0x250c;
+ WACS_ULCORNER->vals[0]= 0x250c;
ACS_ULCORNER = 'l' | __ACS_IS_WACS;
- WACS_LLCORNER->vals[0]= 0x2514;
+ WACS_LLCORNER->vals[0]= 0x2514;
ACS_LLCORNER = 'm' | __ACS_IS_WACS;
- WACS_PLUS->vals[0] = 0x253c;
+ WACS_PLUS->vals[0] = 0x253c;
ACS_PLUS = 'n' | __ACS_IS_WACS;
WACS_HLINE->vals[0] = 0x2500;
ACS_HLINE = 'q' | __ACS_IS_WACS;
@@ -231,13 +231,13 @@
ACS_S1 = 'o' | __ACS_IS_WACS;
WACS_S9->vals[0] = 0x23bd;
ACS_S9 = 's' | __ACS_IS_WACS;
- WACS_LTEE->vals[0] = 0x251c;
+ WACS_LTEE->vals[0] = 0x251c;
ACS_LTEE = 't' | __ACS_IS_WACS;
- WACS_RTEE->vals[0] = 0x2524;
+ WACS_RTEE->vals[0] = 0x2524;
ACS_RTEE = 'u' | __ACS_IS_WACS;
- WACS_BTEE->vals[0] = 0x2534;
+ WACS_BTEE->vals[0] = 0x2534;
ACS_BTEE = 'v' | __ACS_IS_WACS;
- WACS_TTEE->vals[0] = 0x252c;
+ WACS_TTEE->vals[0] = 0x252c;
ACS_TTEE = 'w' | __ACS_IS_WACS;
WACS_VLINE->vals[0] = 0x2502;
ACS_VLINE = 'x' | __ACS_IS_WACS;
@@ -274,7 +274,7 @@
return;
if ((term = *++aofac) == '\0')
return;
- /* Only add characters 1 to 127 */
+ /* Only add characters 1 to 127 */
if (acs < NUM_ACS) {
_wacs_char[acs].vals[ 0 ] = term;
_wacs_char[acs].attributes |= WA_ALTCHARSET;
diff -r 27a2f0aa88af -r 83b51feabf67 lib/libcurses/addnstr.c
--- a/lib/libcurses/addnstr.c Fri Jan 06 09:32:08 2017 +0000
+++ b/lib/libcurses/addnstr.c Fri Jan 06 13:53:18 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: addnstr.c,v 1.14 2014/07/13 01:58:08 blymn Exp $ */
+/* $NetBSD: addnstr.c,v 1.15 2017/01/06 13:53:18 roy 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.14 2014/07/13 01:58:08 blymn Exp $");
+__RCSID("$NetBSD: addnstr.c,v 1.15 2017/01/06 13:53:18 roy Exp $");
#endif
#endif /* not lint */
@@ -146,12 +146,12 @@
* BSD curses: if (n > 0) then "at most n", else "len = strlen(s)"
* ncurses: if (n >= 0) then "at most n", else "len = strlen(s)"
* XCURSES: if (n != -1) then "at most n", else "len = strlen(s)"
- *
+ *
*/
if (n >= 0)
for (p = s, len = 0; n-- && *p++; ++len);
else
len = strlen(s);
-
- return(waddbytes(win, s, (int) len));
+
+ return waddbytes(win, s, (int) len);
}
diff -r 27a2f0aa88af -r 83b51feabf67 lib/libcurses/addwstr.c
--- a/lib/libcurses/addwstr.c Fri Jan 06 09:32:08 2017 +0000
+++ b/lib/libcurses/addwstr.c Fri Jan 06 13:53:18 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: addwstr.c,v 1.2 2007/05/28 15:01:54 blymn Exp $ */
+/* $NetBSD: addwstr.c,v 1.3 2017/01/06 13:53:18 roy Exp $ */
/*
* Copyright (c) 2005 The NetBSD Foundation Inc.
@@ -36,7 +36,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: addwstr.c,v 1.2 2007/05/28 15:01:54 blymn Exp $");
+__RCSID("$NetBSD: addwstr.c,v 1.3 2017/01/06 13:53:18 roy Exp $");
#endif /* not lint */
#include <string.h>
@@ -163,7 +163,7 @@
size_t len;
const wchar_t *p;
cchar_t cc;
- wchar_t wc[ 2 ];
+ wchar_t wc[2];
/*
* BSD curses: if (n > 0) then "at most n", else "len = strlen(s)"
@@ -171,10 +171,10 @@
* XCURSES: if (n != -1) then "at most n", else "len = strlen(s)"
*/
/* compute the length and column width of string */
- if ( n < -1 )
+ if (n < -1)
return ERR;
if (n >= 0)
- for (p = s, len = 0; n-- && *p++; ++len );
+ for (p = s, len = 0; n-- && *p++; ++len);
else
len = wcslen(s);
#ifdef DEBUG
@@ -182,16 +182,16 @@
#endif /* DEBUG */
p = s;
- while ( len ) {
- wc[ 0 ] = *p;
- wc[ 1 ] = L'\0';
- if ( setcchar( &cc, wc, win->wattr, 0, NULL ) == ERR )
+ while (len) {
+ wc[0] = *p;
+ wc[1] = L'\0';
+ if (setcchar( &cc, wc, win->wattr, 0, NULL ) == ERR)
return ERR;
- if ( wadd_wch( win, &cc ) == 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 );
+ __CTRACE(__CTRACE_INPUT, "waddnwstr: (%x,%x,%d) added\n",
+ cc.vals[ 0 ], cc.attributes, cc.elements );
#endif /* DEBUG */
p++, len--;
}
diff -r 27a2f0aa88af -r 83b51feabf67 lib/libcurses/attributes.c
--- a/lib/libcurses/attributes.c Fri Jan 06 09:32:08 2017 +0000
+++ b/lib/libcurses/attributes.c Fri Jan 06 13:53:18 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: attributes.c,v 1.21 2010/12/25 10:08:20 blymn Exp $ */
+/* $NetBSD: attributes.c,v 1.22 2017/01/06 13:53:18 roy Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: attributes.c,v 1.21 2010/12/25 10:08:20 blymn Exp $");
+__RCSID("$NetBSD: attributes.c,v 1.22 2017/01/06 13:53:18 roy Exp $");
#endif /* not lint */
#include "curses.h"
@@ -265,13 +265,13 @@
__CTRACE(__CTRACE_ATTR, "wattr_set: win %p, attr %08x, pair %d\n",
win, attr, pair);
#endif
- wattr_off(win, __ATTRIBUTES, opt);
+ wattr_off(win, __ATTRIBUTES, opt);
/*
* This overwrites any colour setting from the attributes
* and is compatible with ncurses.
*/
- attr = (attr & ~__COLOR) | COLOR_PAIR(pair);
- wattr_on(win, attr, opt);
+ attr = (attr & ~__COLOR) | COLOR_PAIR(pair);
+ wattr_on(win, attr, opt);
return OK;
}
diff -r 27a2f0aa88af -r 83b51feabf67 lib/libcurses/background.c
--- a/lib/libcurses/background.c Fri Jan 06 09:32:08 2017 +0000
+++ b/lib/libcurses/background.c Fri Jan 06 13:53:18 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: background.c,v 1.16 2016/10/22 21:55:06 christos Exp $ */
+/* $NetBSD: background.c,v 1.17 2017/01/06 13:53:18 roy Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: background.c,v 1.16 2016/10/22 21:55:06 christos Exp $");
+__RCSID("$NetBSD: background.c,v 1.17 2017/01/06 13:53:18 roy Exp $");
#endif /* not lint */
#include <stdlib.h>
@@ -167,9 +167,9 @@
#ifndef HAVE_WCHAR
return ERR;
#else
-/* int y, x, i; */
+/* int y, x, i; */
attr_t battr;
-/* nschar_t *np, *tnp, *pnp; */
+/* nschar_t *np, *tnp, *pnp; */
#ifdef DEBUG
__CTRACE(__CTRACE_ATTR, "wbkgrnd: (%p), '%s', %x\n",
@@ -177,7 +177,7 @@
#endif
/* ignore multi-column characters */
- if ( !wch->elements || wcwidth( wch->vals[ 0 ]) > 1 )
+ if (!wch->elements || wcwidth( wch->vals[ 0 ]) > 1)
return ERR;
/* Background attributes (check colour). */
@@ -205,47 +205,47 @@
#endif
/* ignore multi-column characters */
- if ( !wch->elements || wcwidth( wch->vals[ 0 ]) > 1 )
+ if (!wch->elements || wcwidth(wch->vals[0]) > 1)
return;
/* Background character. */
tnp = np = win->bnsp;
- if ( wcwidth( wch->vals[ 0 ]))
- win->bch = wch->vals[ 0 ];
+ if (wcwidth( wch->vals[0]))
+ win->bch = wch->vals[0];
else {
- if ( !np ) {
+ if (!np) {
np = malloc(sizeof(nschar_t));
if (!np)
return;
np->next = NULL;
win->bnsp = np;
}
- np->ch = wch->vals[ 0 ];
+ np->ch = wch->vals[0];
tnp = np;
np = np->next;
}
/* add non-spacing characters */
- if ( wch->elements > 1 ) {
- for ( i = 1; i < wch->elements; i++ ) {
+ if (wch->elements > 1) {
+ for (i = 1; i < wch->elements; i++) {
if ( !np ) {
np = malloc(sizeof(nschar_t));
if (!np)
return;
np->next = NULL;
- if ( tnp )
+ if (tnp)
tnp->next = np;
else
win->bnsp = np;
}
- np->ch = wch->vals[ i ];
+ np->ch = wch->vals[i];
tnp = np;
np = np->next;
}
}
/* clear the old non-spacing characters */
- while ( np ) {
+ while (np) {
Home |
Main Index |
Thread Index |
Old Index