Module Name:    src
Committed By:   christos
Date:           Wed Mar 16 15:48:01 UTC 2016

Modified Files:
        src/bin/sh: syntax.h

Log Message:
factor out common code in macro.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/bin/sh/syntax.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/sh/syntax.h
diff -u src/bin/sh/syntax.h:1.3 src/bin/sh/syntax.h:1.4
--- src/bin/sh/syntax.h:1.3	Wed Mar 16 11:45:40 2016
+++ src/bin/sh/syntax.h	Wed Mar 16 11:48:01 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: syntax.h,v 1.3 2016/03/16 15:45:40 christos Exp $	*/
+/*	$NetBSD: syntax.h,v 1.4 2016/03/16 15:48:01 christos Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -68,10 +68,11 @@
 
 /* These defines assume that the digits are contiguous (which is guaranteed) */
 #define	is_digit(c)	((unsigned)((c) - '0') <= 9)
-#define	is_alpha(c)	((is_type+SYNBASE)[c] & (ISUPPER|ISLOWER))
-#define	is_name(c)	((is_type+SYNBASE)[c] & (ISUPPER|ISLOWER|ISUNDER))
-#define	is_in_name(c)	((is_type+SYNBASE)[c] & (ISUPPER|ISLOWER|ISUNDER|ISDIGIT))
-#define is_special(c)	((is_type+SYNBASE)[c] & (ISSPECL|ISDIGIT))
+#define sh_ctype(c)	(is_type+SYNBASE)[(unsigned char)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))
+#define is_special(c)	(sh_ctype(c) & (ISSPECL|ISDIGIT))
 #define digit_val(c)	((c) - '0')
 
 extern const char basesyntax[];

Reply via email to