OSSP CVS Repository

ossp - Check-in [4880]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 4880
Date: 2004-Nov-28 18:28:27 (local)
2004-Nov-28 17:28:27 (UTC)
User:rse
Branch:
Comment: improve performance by using yyleng instead of calculating the string length on-the-fly
Tickets:
Inspections:
Files:
ossp-pkg/cfg/cfg_syn_scan.l      1.21 -> 1.22     6 inserted, 6 deleted

ossp-pkg/cfg/cfg_syn_scan.l 1.21 -> 1.22

--- cfg_syn_scan.l       2004/11/28 17:23:45     1.21
+++ cfg_syn_scan.l       2004/11/28 17:28:27     1.22
@@ -174,7 +174,7 @@
     cfg_buf_append(CTX->buf, NULL, 0, yytext[1]);
 }
 <SS_DQ>[^\\\"]+ {
-    cfg_buf_append(CTX->buf, yytext, 0, 0);
+    cfg_buf_append(CTX->buf, yytext, yyleng, 0);
 }
 <SS_DQ>(.|\n) {
     cfg_buf_append(CTX->buf, NULL, 0, yytext[1]);
@@ -201,10 +201,10 @@
     cfg_buf_append(CTX->buf, NULL, 0, yytext[1]);
 }
 <SS_SQ>\\[^\\\'] {
-    cfg_buf_append(CTX->buf, yytext, 2, 0);
+    cfg_buf_append(CTX->buf, yytext, yyleng, 0);
 }
 <SS_SQ>[^\\\']+ {
-    cfg_buf_append(CTX->buf, yytext, 0, 0);
+    cfg_buf_append(CTX->buf, yytext, yyleng, 0);
 }
 <SS_SQ>(.|\n) {
     cfg_buf_append(CTX->buf, NULL, 0, yytext[1]);
@@ -226,13 +226,13 @@
     if (yytext[1] == cQuoteOpen || yytext[1] == cQuoteClose)
         cfg_buf_append(CTX->buf, NULL, 0, yytext[1]);
     else
-        cfg_buf_append(CTX->buf, yytext, 2, 0);
+        cfg_buf_append(CTX->buf, yytext, yyleng, 0);
 }
 <SS_FQ>\\\n[ \t]* {
     /* no-op */
 }
 <SS_FQ>{FQDELN} {
-    cfg_buf_append(CTX->buf, yytext, 0, 0);
+    cfg_buf_append(CTX->buf, yytext, yyleng, 0);
 }
 <SS_FQ>(.|\n) {
     if (yytext[0] == cQuoteOpen || yytext[0] == cQuoteClose) {
@@ -272,7 +272,7 @@
     /* no-op */
 }
 <SS_PT>[^ \t\n;{}\\"']+ {
-    cfg_buf_append(CTX->buf, yytext, 0, 0);
+    cfg_buf_append(CTX->buf, yytext, yyleng, 0);
 }
 <SS_PT>(.|\n) {
     cfg_buf_content(CTX->buf, &yylval->cpString, NULL, NULL);

CVSTrac 2.0.1