]> granicus.if.org Git - nethack/commitdiff
ctype tweaks
authorPatR <rankin@nethack.org>
Sun, 29 May 2016 00:18:51 +0000 (17:18 -0700)
committerPatR <rankin@nethack.org>
Sun, 29 May 2016 00:18:51 +0000 (17:18 -0700)
None of these explains the Windows assertion failure.
 end.c - post-3.6.0
 options.c - in #else block of #if win32
 winmenu.c - X11

src/end.c
src/options.c
win/X11/winmenu.c

index 437b9072d55eca3e49b82b8f8cc3b6df60ec544b..57f8425bc87dd1b3daf6d14808f5c99e18a9e037 100644 (file)
--- a/src/end.c
+++ b/src/end.c
@@ -1678,7 +1678,7 @@ boolean ask;
                 pfx = !strncmpi(buf, "the ", 3) ? 0
                       : !strncmpi(buf, "an ", 3) ? 1
                         : !strncmpi(buf, "a ", 2) ? 2
-                          : !isdigit(buf[2]) ? 4 : 0;
+                          : !digit(buf[2]) ? 4 : 0;
                 if (class_header)
                     ++pfx;
                 Sprintf(buftoo, "%*s%s", pfx, "", buf);
index 3f35583b5743d0163ad76c0165d854f82aff200d..69db5926f3a3ec2f191894d74c9dd76f957bf809 100644 (file)
@@ -2207,12 +2207,13 @@ boolean tinitial, tfrom_file;
             bad_negation(fullname, TRUE);
         return;
     }
+
 #ifdef CHANGE_COLOR
     if (match_optname(opts, "palette", 3, TRUE)
 #ifdef MAC
         || match_optname(opts, "hicolor", 3, TRUE)
 #endif
-            ) {
+        ) {
         int color_number, color_incr;
 
 #ifndef WIN32
@@ -2227,17 +2228,16 @@ boolean tinitial, tfrom_file;
             }
             color_number = CLR_MAX + 4; /* HARDCODED inverse number */
             color_incr = -1;
-        } else {
+        } else
 #endif
+        {
             if (negated) {
                 bad_negation("palette", FALSE);
                 return;
             }
             color_number = 0;
             color_incr = 1;
-#ifdef MAC
         }
-#endif
 #ifdef WIN32
         op = string_for_opt(opts, TRUE);
         if (!alternative_palette(op))
@@ -2264,8 +2264,8 @@ boolean tinitial, tfrom_file;
 #else
                         rgb <<= 8;
 #endif
-                        tmp = *(pt++);
-                        if (isalpha(tmp)) {
+                        tmp = *pt++;
+                        if (isalpha((uchar) tmp)) {
                             tmp = (tmp + 9) & 0xf; /* Assumes ASCII... */
                         } else {
                             tmp &= 0xf; /* Digits in ASCII too... */
@@ -2277,9 +2277,8 @@ boolean tinitial, tfrom_file;
                         rgb += tmp;
                     }
                 }
-                if (*pt == '/') {
+                if (*pt == '/')
                     pt++;
-                }
                 change_color(color_number, rgb, reverse);
                 color_number += color_incr;
             }
index 97f8592a4597ae6f5d26bd4568b4cf6d5d7ed611..75c99b57a31b938052adb54e98f47ae750bf08c3 100644 (file)
@@ -38,7 +38,6 @@
 
 #include "hack.h"
 #include "winX.h"
-#include <ctype.h>
 
 static void FDECL(menu_select, (Widget, XtPointer, XtPointer));
 static void FDECL(invert_line, (struct xwindow *, x11_menu_item *, int, long));
@@ -251,7 +250,7 @@ Cardinal *num_params;
             select_none(wp);
         } else if (ch == '\n' || ch == '\r') {
             ; /* accept */
-        } else if (isdigit(ch)) {
+        } else if (digit(ch)) {
             /* special case: '0' is also the default ball class */
             if (ch == '0' && !menu_info->counting
                 && index(menu_info->curr_menu.gacc, ch))