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
 %}
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to