diff options
author | Michael Shalayeff <mickey@cvs.openbsd.org> | 2005-01-08 19:36:31 +0000 |
---|---|---|
committer | Michael Shalayeff <mickey@cvs.openbsd.org> | 2005-01-08 19:36:31 +0000 |
commit | 5ca94e82eaf44a93c1a330e7a29cf878d4d8f59b (patch) | |
tree | 6383c46e4d5e419c88167650e29f26f631d7518b /sys/ddb | |
parent | 9d48f0b4377bbf84840e8fbf85ba84a92db4f1e4 (diff) |
radical size reduction from andreas@
Diffstat (limited to 'sys/ddb')
-rw-r--r-- | sys/ddb/db_hangman.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/sys/ddb/db_hangman.c b/sys/ddb/db_hangman.c index addcc4d8edc..c72564f5344 100644 --- a/sys/ddb/db_hangman.c +++ b/sys/ddb/db_hangman.c @@ -1,4 +1,4 @@ -/* $OpenBSD: db_hangman.c,v 1.24 2003/06/02 19:27:14 mickey Exp $ */ +/* $OpenBSD: db_hangman.c,v 1.25 2005/01/08 19:36:30 mickey Exp $ */ /* * Copyright (c) 1996 Theo de Raadt, Michael Shalayeff @@ -48,8 +48,9 @@ struct _abc { char abc[26+2]; /* for int32 alignment */ }; -#define TOLOWER(c) (('A'<=(c)&&(c)<='Z')?(c)-'A'+'a':(c)) -#define ISALPHA(c) (('a'<=(c)&&(c)<='z')||('A'<=(c)&&(c)<='Z')) +#define TOLOWER(c) ((c)|0x20) +#define ISLOWALPHA(c) ('a'<=(c) && (c)<='z') +#define ISALPHA(c) ISLOWALPHA(TOLOWER(c)) void db_hang(int, char *, struct _abc *); @@ -158,8 +159,10 @@ db_hang(tries, word, sabc) cnputc((*p >= '0' && *p <= '9') ? ((tries <= (*p) - '0') ? substchar[(*p) - '0'] : ' ') : *p); - for (p = word; (c = TOLOWER(*p)); p++) - cnputc(ISALPHA(c) && ABC_ISCLR(c) ? '-' : *p); + for (p = word; *p; p++) { + c = TOLOWER(*p); + cnputc(ISLOWALPHA(c) && ABC_ISCLR(c) ? '-' : *p); + } #ifdef ABC_WRONGSTR db_printf(" (%s)\r", ABC_WRONGSTR); @@ -218,7 +221,7 @@ db_hangman(addr, haddr, count, modif) c = cngetc(); c = TOLOWER(c); - if (ISALPHA(c) && ABC_ISCLR(c)) { + if (ISLOWALPHA(c) && ABC_ISCLR(c)) { register char *p; register size_t n; |