Index: gozilla/gozilla.c
===================================================================
RCS file: /sources/global/global/gozilla/gozilla.c,v
retrieving revision 1.44
diff -u -p -r1.44 gozilla.c
--- gozilla/gozilla.c	17 Aug 2006 11:33:41 -0000	1.44
+++ gozilla/gozilla.c	2 Sep 2006 05:57:18 -0000
@@ -60,9 +60,6 @@ int isprotocol(const char *);
 int convertpath(const char *, const char *, const char *, STRBUF *);
 void makefileurl(const char *, int, STRBUF *);
 void show_page_by_url(const char *, const char *);
-#ifndef isblank
-#define isblank(c)	((c) == ' ' || (c) == '\t')
-#endif
 
 char cwd[MAXPATHLEN+1];
 char root[MAXPATHLEN+1];
Index: htags/src2html.c
===================================================================
RCS file: /sources/global/global/htags/src2html.c,v
retrieving revision 1.54
diff -u -p -r1.54 src2html.c
--- htags/src2html.c	31 Aug 2006 17:31:09 -0000	1.54
+++ htags/src2html.c	2 Sep 2006 05:57:18 -0000
@@ -644,42 +644,13 @@ put_end_of_line(int lineno)
  *	o)	sb	encoded URL
  *	i)	url	URL
  */
-static unsigned char urlchar[256];
-static void
-init_urlchar(void)
-{
-	int c;
-
-	for (c = 'A'; c <= 'Z'; c++)
-		urlchar[c] = 1;
-	for (c = 'a'; c <= 'z'; c++)
-		urlchar[c] = 1;
-	for (c = '0'; c <= '9'; c++)
-		urlchar[c] = 1;
-	urlchar['/'] = 1;
-	urlchar['-'] = 1;
-	urlchar['_'] = 1;
-	urlchar['.'] = 1;
-	urlchar['!'] = 1;
-	urlchar['~'] = 1;
-	urlchar['*'] = 1;
-	urlchar['\''] = 1;
-	urlchar['('] = 1;
-	urlchar[')'] = 1;
-}
 static void
 encode(STRBUF *sb, const char *url)
 {
 	int c;
-	static int init;
-
-	if (!init) {
-		init_urlchar();
-		init = 1;
-	}
 
 	while ((c = (unsigned char)*url++) != '\0') {
-		if (urlchar[c]) {
+		if (isurlchar(c)) {
 			strbuf_putc(sb, c);
 		} else {
 			strbuf_putc(sb, '%');
Index: libutil/char.c
===================================================================
RCS file: /sources/global/global/libutil/char.c,v
retrieving revision 1.13
diff -u -p -r1.13 char.c
--- libutil/char.c	24 Apr 2006 12:25:57 -0000	1.13
+++ libutil/char.c	2 Sep 2006 05:57:18 -0000
@@ -26,34 +26,25 @@
 #include "char.h"
 #include "strbuf.h"
 
-static char regexchar[256];
-static int init;
+#if '\n' != 0x0a || ' ' != 0x20 || '0' != 0x30 \
+  && 'A' != 0x41 || 'a' != 0x61 || '!' != 0x21
+#error "Unsupported character encoding."
+#endif
 
-#define ISREGEXCHAR(c)  (regexchar[(unsigned char)(c)])
-
-/* initialize for isregex() */
-static void
-initialize(void)
-{
-	regexchar['^'] = regexchar['$'] = regexchar['{'] =
-	regexchar['}'] = regexchar['('] = regexchar[')'] =
-	regexchar['.'] = regexchar['*'] = regexchar['+'] =
-	regexchar['['] = regexchar[']'] = regexchar['?'] =
-	regexchar['\\'] = init = 1;
-}
-/*
- * isregexchar: test whether or not regular expression char.
- *
- *	i)	c	char
- *	r)		1: is regex, 0: not regex
- */
-int
-isregexchar(int c)
-{
-	if (!init)
-		initialize();
-	return ISREGEXCHAR(c);
-}
+#define R	REGEXCHAR
+#define U	URLCHAR
+#define RU	REGEXCHAR | URLCHAR
+#define B	BLANKCHAR
+const unsigned char chartype[256] = {
+	0, 0, 0, 0, 0, 0, 0, 0, 0, B, 0, 0, 0, 0, 0, 0,
+	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+	B, U, 0, 0, R, 0, 0, U,RU,RU,RU, R, 0, U,RU, U,	/*  !"#$%&'()*+,-./ */
+	U, U, U, U, U, U, U, U, U, U, 0, 0, 0, 0, 0, R,	/* 0123456789:;<=>? */
+	0, U, U, U, U, U, U, U, U, U, U, U, U, U, U, U,	/* @ABCDEFGHIJKLMNO */
+	U, U, U, U, U, U, U, U, U, U, U, R, R, R, R, U,	/* PQRSTUVWXYZ[\]^_ */
+	0, U, U, U, U, U, U, U, U, U, U, U, U, U, U, U,	/* `abcdefghijklmno */
+	U, U, U, U, U, U, U, U, U, U, U, R, 0, R, U, 0,	/* pqrstuvwxyz{|}~  */
+};
 /*
  * isregex: test whether or not regular expression
  *
@@ -65,10 +56,8 @@ isregex(const char *s)
 {
 	int c;
 
-	if (!init)
-		initialize();
 	while ((c = *s++) != '\0')
-		if (ISREGEXCHAR(c))
+		if (isregexchar(c))
 			return 1;
 	return 0;
 }
Index: libutil/char.h
===================================================================
RCS file: /sources/global/global/libutil/char.h,v
retrieving revision 1.6
diff -u -p -r1.6 char.h
--- libutil/char.h	10 May 2005 05:17:52 -0000	1.6
+++ libutil/char.h	2 Sep 2006 05:57:18 -0000
@@ -21,7 +21,25 @@
 #ifndef _CHAR_H_
 #define _CHAR_H_
 
-int isregexchar(int);
+#include <ctype.h>
+
+extern const unsigned char chartype[256];
+
+#define REGEXCHAR		1
+#define URLCHAR			2
+#define BLANKCHAR		4
+#define test_chartype(c, t)	(chartype[(unsigned char)(c)] & (t))
+
+/* test whether or not regular expression char. */
+#define isregexchar(c)		test_chartype(c, REGEXCHAR)
+
+/* test whether can be included in URL without escaping. */
+#define isurlchar(c)		test_chartype(c, URLCHAR)
+
+#ifndef isblank
+#define isblank(c)		test_chartype(c, BLANKCHAR)
+#endif
+
 int isregex(const char *);
 const char *quote_string(const char *);
 
Index: libutil/conf.c
===================================================================
RCS file: /sources/global/global/libutil/conf.c,v
retrieving revision 1.47
diff -u -p -r1.47 conf.c
--- libutil/conf.c	25 Jul 2006 11:10:10 -0000	1.47
+++ libutil/conf.c	2 Sep 2006 05:57:18 -0000
@@ -35,6 +35,7 @@
 
 #include "gparam.h"
 #include "checkalloc.h"
+#include "char.h"
 #include "conf.h"
 #include "die.h"
 #include "env.h"
@@ -61,10 +62,6 @@ static void trim(char *);
 static const char *readrecord(const char *);
 static void includelabel(STRBUF *, const char *, int);
 
-#ifndef isblank
-#define isblank(c)	((c) == ' ' || (c) == '\t')
-#endif
-
 /*
  * trim: trim string.
  *
Index: libutil/split.c
===================================================================
RCS file: /sources/global/global/libutil/split.c,v
retrieving revision 1.15
diff -u -p -r1.15 split.c
--- libutil/split.c	4 Oct 2005 07:59:04 -0000	1.15
+++ libutil/split.c	2 Sep 2006 05:57:18 -0000
@@ -22,6 +22,7 @@
 #include <config.h>
 #endif
 #include <stdio.h>
+#include "char.h"
 #include "split.h"
 
 /*
@@ -78,8 +79,6 @@
  * Recover() recover initial status of line with saved char in savec.
  */
 
-#define isblank(c)	((c) == ' ' || (c) == '\t')
-
 /*
  * split: split a string into pieces
  *
Index: libutil/strbuf.c
===================================================================
RCS file: /sources/global/global/libutil/strbuf.c,v
retrieving revision 1.31
diff -u -p -r1.31 strbuf.c
--- libutil/strbuf.c	25 Jul 2006 11:10:10 -0000	1.31
+++ libutil/strbuf.c	2 Sep 2006 05:57:18 -0000
@@ -32,13 +32,11 @@
 #include <strings.h>
 #endif
 
+#include "char.h"
 #include "checkalloc.h"
 #include "die.h"
 #include "strbuf.h"
 
-#ifndef isblank
-#define isblank(c)	((c) == ' ' || (c) == '\t')
-#endif
 /*
 
 String buffer: usage and memory status
Index: libutil/strmake.h
===================================================================
RCS file: /sources/global/global/libutil/strmake.h,v
retrieving revision 1.8
diff -u -p -r1.8 strmake.h
--- libutil/strmake.h	13 May 2005 23:51:24 -0000	1.8
+++ libutil/strmake.h	2 Sep 2006 05:57:18 -0000
@@ -22,17 +22,13 @@
 #ifndef _STRMAKE_H_
 #define _STRMAKE_H_
 
-#include <ctype.h>
+#include "char.h"
 
 #define	TRIM_HEAD	1
 #define TRIM_TAIL	2
 #define TRIM_BOTH	3
 #define TRIM_ALL	4
 
-#ifndef isblank
-#define isblank(c)	((c) == ' ' || (c) == '\t')
-#endif
-
 #define SKIP_BLANKS(p)	do {						\
 	while (*p && isblank((unsigned char)*p))			\
 		p++;							\
