isspace() usage
Replace most uses of isspace() with a simple test for ' ' after processing the string buffer with mungspaces (which replaces tab with space, converts instances of consecutive whitespace into a single space, and removes leading and trailing spaces). The uses where this wasn't done now cast their argument to (uchar) so that platforms with signed chars will never pass negative values to it. I didn't mess with the menu coloring code (except for casts to the isspace() argument); it almost certainly could benefit from using mungspaces. I did mess with the symset processing quite a bit, and hope I haven't accidentally broken anything. Default symbols and DECgraphics symbols still parse and display ok, so the rest of dat/symbols should be ok too. I didn't test symbols in the user's config file because I don't remember how that's supposed to work.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.5 hacklib.c $NHDT-Date: 1428806394 2015/04/12 02:39:54 $ $NHDT-Branch: master $:$NHDT-Revision: 1.34 $ */
|
||||
/* NetHack 3.5 hacklib.c $NHDT-Date: 1429953063 2015/04/25 09:11:03 $ $NHDT-Branch: master $:$NHDT-Revision: 1.38 $ */
|
||||
/* NetHack 3.5 hacklib.c $Date: 2009/05/06 10:46:32 $ $Revision: 1.23 $ */
|
||||
/* SCCS Id: @(#)hacklib.c 3.5 2007/04/30 */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
@@ -135,6 +135,7 @@ char *bp;
|
||||
boolean was_space = TRUE;
|
||||
|
||||
for (p = p2 = bp; (c = *p) != '\0'; p++) {
|
||||
if (c == '\n') break; /* treat newline the same as end-of-string */
|
||||
if (c == '\t') c = ' ';
|
||||
if (c != ' ' || !was_space) *p2++ = c;
|
||||
was_space = (c == ' ');
|
||||
|
||||
Reference in New Issue
Block a user