← Commit list

0d1f6a54f

Denys Vlasenko
Denys Vlasenko
2025-08-14
SUCCESS Duration: 167s

Subject

hush: allow faster parsing for "./:@" characters

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

shell/hush.c+7 -2
@@ -5605,8 +5605,13 @@ static struct pipe *parse_stream(char **pstring,
debug_printf_parse(": ch:%c (%d) globprotect:%d\n",
ch, ch, !!(ctx.word.o_expflags & EXP_FLAG_GLOBPROTECT_CHARS));
# if ENABLE_HUSH_NEED_FOR_SPEED
- if (isalnum(ch)) {
- /* 0-9A-Za-z are never special and just go into the current word */
+ if ((ch >= '.' && ch <= ':') /* ASCII "./0123456789:" */
+ /* can't include preceding "+,-" above: "-" needs glob-escaping (example?) */
+ || (ch >= '@' && ch <= 'Z') /* ASCII "@A..Z" */
+ || (ch >= 'a' && ch <= 'z') /* ASCII "a..Z" */
+ /* can't include preceding "^_`" above because of "`". Pity. "_" is relatively common */
+ ) {
+ /* These are never special and just go into the current word */
/* ~5% faster parsing of typical shell scripts */
INLINED_o_addchr(&ctx.word, ch);
continue;