Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/bin/sh Remove wrong unsigned cast, index can be negative. Ca...



details:   https://anonhg.NetBSD.org/src/rev/3ff00dd80d5b
branches:  trunk
changeset: 344182:3ff00dd80d5b
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Mar 16 17:01:39 2016 +0000

description:
Remove wrong unsigned cast, index can be negative. Cast char to int so that
gcc does not warn. Probably better to do the offset at runtime, but that
would cost more.

diffstat:

 bin/sh/syntax.h |  4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diffs (18 lines):

diff -r 8cfd2fff3a87 -r 3ff00dd80d5b bin/sh/syntax.h
--- a/bin/sh/syntax.h   Wed Mar 16 16:13:16 2016 +0000
+++ b/bin/sh/syntax.h   Wed Mar 16 17:01:39 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: syntax.h,v 1.4 2016/03/16 15:48:01 christos Exp $      */
+/*     $NetBSD: syntax.h,v 1.5 2016/03/16 17:01:39 christos Exp $      */
 
 /*-
  * Copyright (c) 1991, 1993
@@ -68,7 +68,7 @@
 
 /* These defines assume that the digits are contiguous (which is guaranteed) */
 #define        is_digit(c)     ((unsigned)((c) - '0') <= 9)
-#define sh_ctype(c)    (is_type+SYNBASE)[(unsigned char)c]
+#define sh_ctype(c)    (is_type+SYNBASE)[(int)c]
 #define        is_alpha(c)     (sh_ctype(c) & (ISUPPER|ISLOWER))
 #define        is_name(c)      (sh_ctype(c) & (ISUPPER|ISLOWER|ISUNDER))
 #define        is_in_name(c)   (sh_ctype(c) & (ISUPPER|ISLOWER|ISUNDER|ISDIGIT))



Home | Main Index | Thread Index | Old Index