summaryrefslogtreecommitdiff
path: root/node.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2010-12-04 21:50:25 +0200
committerArnold D. Robbins <arnold@skeeve.com>2010-12-04 21:50:25 +0200
commit16458663c3bdf640e3352653ea94a89fb2949ad4 (patch)
treea5f4d91a8264affc34a2b9f91028419fb70535c2 /node.c
parent3c4a8232caabe74517277ec31adaca838251a256 (diff)
downloadgawk-16458663c3bdf640e3352653ea94a89fb2949ad4.tar.gz
Speed up single byte cases. See ChangeLog.
Diffstat (limited to 'node.c')
-rw-r--r--node.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/node.c b/node.c
index d181bff9..0dd5f52a 100644
--- a/node.c
+++ b/node.c
@@ -706,11 +706,9 @@ str2wstr(NODE *n, size_t **ptr)
* 9/2010: Check the current byte; if it's a valid character,
* then it doesn't start a multibyte sequence. This brings a
* big speed up. Thanks to Ulrich Drepper for the tip.
+ * 11/2010: Thanks to Paolo Bonzini for some even faster code.
*/
- if ( isprint(*sp)
- || isgraph(*sp)
- || iscntrl(*sp)
- || *sp == '\0' ) {
+ if (is_valid_character(*sp)) {
count = 1;
wc = *sp;
} else
@@ -894,3 +892,18 @@ get_ieee_magic_val(const char *val)
return v;
}
+
+#ifdef MBS_SUPPORT
+wint_t btowc_cache[256];
+
+/* init_btowc_cache --- initialize the cache */
+
+void init_btowc_cache()
+{
+ int i;
+
+ for (i = 0; i < 255; i++) {
+ btowc_cache[i] = btowc(i);
+ }
+}
+#endif