From 0bee28331eca4c0b6a8e4579b3ae380381452b33 Mon Sep 17 00:00:00 2001 From: Jilles Tjoelker Date: Tue, 23 Nov 2010 20:46:06 +0000 Subject: [PATCH] sh: Pass multiple bytes at a time to lex. This speeds up the expansion/arith6.0 test considerably. --- bin/sh/arith_lex.l | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/bin/sh/arith_lex.l b/bin/sh/arith_lex.l index 1113d2992970..b4a04d3fd3de 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 %}