Date: Tue, 23 Nov 2010 20:46:06 +0000 (UTC) From: Jilles Tjoelker <jilles@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r215766 - head/bin/sh Message-ID: <201011232046.oANKk6Q1042756@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jilles Date: Tue Nov 23 20:46:06 2010 New Revision: 215766 URL: http://svn.freebsd.org/changeset/base/215766 Log: sh: Pass multiple bytes at a time to lex. This speeds up the expansion/arith6.0 test considerably. Modified: head/bin/sh/arith_lex.l Modified: head/bin/sh/arith_lex.l ============================================================================== --- head/bin/sh/arith_lex.l Tue Nov 23 20:28:21 2010 (r215765) +++ head/bin/sh/arith_lex.l Tue Nov 23 20:46:06 2010 (r215766) @@ -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 %}
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201011232046.oANKk6Q1042756>