src/svf/svf_flex.l (fix_yylloc): Accept the string length from caller to avoid useless overhead of calling strlen(). Fix by Frans Meulenbroeks.

git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@1837 b68d4a1b-bc3d-0410-92ed-d4ac073336b7
master
Mike Frysinger 15 years ago
parent 9760b40157
commit 69b34c22ea

@ -8,6 +8,9 @@
the caller, and have the callers re-use that. This avoids useless overhead
of calling strlen() over and over. Fix by Frans Meulenbroeks.
* src/svf/svf_flex.l (fix_yylloc): Accept the string length from caller to
avoid useless overhead of calling strlen(). Fix by Frans Meulenbroeks.
2010-08-26 Mike Frysinger <vapier@gentoo.org>
* src/tap/cable/gpio.c: Rewrite to use raw file descriptors when working with

@ -51,7 +51,7 @@
static int map_keyw_ident(YYSTYPE *, char *);
static int align_string(char *);
static void fix_yylloc(YYLTYPE *, char *);
static void fix_yylloc(YYLTYPE *, char *, int);
static void fix_yylloc_nl(YYLTYPE *, char *, YY_EXTRA_TYPE);
static void progress_nl(YYLTYPE *, YY_EXTRA_TYPE);
@ -87,7 +87,7 @@ COMMENT (!.*)|("//".*)[^\n]
/* token is a keyword or identifier */
int keyw;
fix_yylloc(yylloc, yytext);
fix_yylloc(yylloc, yytext, yyleng);
keyw = map_keyw_ident(yylval, yytext);
/* enable detection of VECTOR_STRING when this is a PIO command */
@ -125,7 +125,7 @@ COMMENT (!.*)|("//".*)[^\n]
*point_pos = extra->decimal_point;
yylval->dvalue = strtod(real_string, (char **) NULL);
fix_yylloc(yylloc, yytext);
fix_yylloc(yylloc, yytext, yyleng);
free(real_string);
} else
@ -180,18 +180,18 @@ COMMENT (!.*)|("//".*)[^\n]
{WSPACE}+ {
/* token is a white space character */
fix_yylloc(yylloc, yytext);
fix_yylloc(yylloc, yytext, yyleng);
} /* end of white space */
{COMMENT} {
/* token is a comment */
fix_yylloc(yylloc, yytext);
fix_yylloc(yylloc, yytext, yyleng);
} /* end of comment */
<INITIAL>"(" {
fix_yylloc(yylloc, yytext);
fix_yylloc(yylloc, yytext, yyleng);
return(yytext[0]);
} /* end of left or right parenthesis */
@ -199,13 +199,13 @@ COMMENT (!.*)|("//".*)[^\n]
/* scanning until a left parenthesis under this start condition implicitly
skips whitespace that would have been attributed to HEXA_NUM_FRAGMENT
otherwise */
fix_yylloc(yylloc, yytext);
fix_yylloc(yylloc, yytext, yyleng);
/* now hand over to HEXA_NUM_FRAGMENT */
BEGIN(expect_hexa_num);
return(yytext[0]);
} /* end of left or right parenthesis */
")" {
fix_yylloc(yylloc, yytext);
fix_yylloc(yylloc, yytext, yyleng);
BEGIN(INITIAL);
return(yytext[0]);
} /* end of left or right parenthesis */
@ -227,7 +227,7 @@ COMMENT (!.*)|("//".*)[^\n]
/* release start condition */
BEGIN(INITIAL);
fix_yylloc(yylloc, yytext);
fix_yylloc(yylloc, yytext, yyleng);
return(yytext[0]);
} /* end of statement character */
@ -354,11 +354,11 @@ align_string (char *str)
static void
fix_yylloc (YYLTYPE *mylloc, char *str)
fix_yylloc (YYLTYPE *mylloc, char *str, int len)
{
mylloc->first_line = mylloc->last_line;
mylloc->first_column = mylloc->last_column;
mylloc->last_column += strlen (str);
mylloc->last_column += len;
}

Loading…
Cancel
Save