diff options
author | jilles <jilles@FreeBSD.org> | 2010-11-23 20:46:06 +0000 |
---|---|---|
committer | jilles <jilles@FreeBSD.org> | 2010-11-23 20:46:06 +0000 |
commit | 2ece5375f3e7cf2d34221bd146e46defb9005f72 (patch) | |
tree | edbfd47cb4742ba3a329dff28e582ed4ec9ebc79 /bin/sh | |
parent | 95f9248b6efb8509cec4f0834b027d84516632b7 (diff) | |
download | FreeBSD-src-2ece5375f3e7cf2d34221bd146e46defb9005f72.zip FreeBSD-src-2ece5375f3e7cf2d34221bd146e46defb9005f72.tar.gz |
sh: Pass multiple bytes at a time to lex.
This speeds up the expansion/arith6.0 test considerably.
Diffstat (limited to 'bin/sh')
-rw-r--r-- | bin/sh/arith_lex.l | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/bin/sh/arith_lex.l b/bin/sh/arith_lex.l index 1113d29..b4a04d3 100644 --- a/bin/sh/arith_lex.l +++ b/bin/sh/arith_lex.l @@ -53,7 +53,15 @@ int yylex(void); #undef YY_INPUT #define YY_INPUT(buf,result,max) \ - result = (*buf = *arith_buf++) ? 1 : YY_NULL; + do { \ + result = strnlen(arith_buf, max); \ + if (result == 0) \ + result = YY_NULL; \ + else { \ + memcpy(buf, arith_buf, result); \ + arith_buf += result; \ + } \ + } while (0); #define YY_NO_UNPUT #define YY_NO_INPUT %} |