Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 5 Feb 2011 21:40:57 +0000 (UTC)
From:      Jilles Tjoelker <jilles@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r218349 - stable/8/bin/sh
Message-ID:  <201102052140.p15Levr2041906@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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
 %}
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201102052140.p15Levr2041906>