svn commit: r218349 - stable/8/bin/sh

Jilles Tjoelker jilles at FreeBSD.org
Sat Feb 5 21:40:57 UTC 2011


Author: jilles
Date: Sat Feb  5 21:40:57 2011
New Revision: 218349
URL: http://svn.freebsd.org/changeset/base/218349

Log:
  MFC r215766: sh: Pass multiple bytes at a time to lex.
  
  This speeds up the expansion/arith6.0 test considerably.

Modified:
  stable/8/bin/sh/arith_lex.l
Directory Properties:
  stable/8/bin/sh/   (props changed)

Modified: stable/8/bin/sh/arith_lex.l
==============================================================================
--- stable/8/bin/sh/arith_lex.l	Sat Feb  5 21:39:14 2011	(r218348)
+++ stable/8/bin/sh/arith_lex.l	Sat Feb  5 21:40:57 2011	(r218349)
@@ -60,7 +60,15 @@ static struct varname *varnames;
 
 #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
 %}
 


More information about the svn-src-stable-8 mailing list