From ce87f32df5e0b77ff01f813898e76a447b7a26b8 Mon Sep 17 00:00:00 2001 From: Ron Pinkas Date: Tue, 22 Aug 2000 17:39:34 +0000 Subject: [PATCH] 2000-08-22 10:40 UTC+0800 Ron Pinkas * source/compiler/simplex.c * source/compiler/harbour.slx * source/macro/macro.slx ! Removed un-needed calls to strlen(). --- harbour/ChangeLog | 6 ++++++ harbour/source/compiler/harbour.slx | 8 ++++---- harbour/source/compiler/simplex.c | 4 ++-- harbour/source/macro/macro.slx | 8 ++++---- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index f4c10c420d..68f90a8544 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,9 @@ +2000-08-22 10:40 UTC+0800 Ron Pinkas + * source/compiler/simplex.c + * source/compiler/harbour.slx + * source/macro/macro.slx + ! Removed un-needed calls to strlen(). + 2000-08-21 15:45 UTC+0800 Ron Pinkas * source/compiler/simplex.c ! Optimized Keywords and Words search, Lexer is ~5% faster. diff --git a/harbour/source/compiler/harbour.slx b/harbour/source/compiler/harbour.slx index 881e4588ae..e8ad657f1b 100644 --- a/harbour/source/compiler/harbour.slx +++ b/harbour/source/compiler/harbour.slx @@ -852,7 +852,7 @@ LANGUAGE_RULES_ARE { else\ {\ yytext = x;\ - yyleng = strlen( yytext );\ + yyleng = iLen;\ \ if( *yytext == '_' || *yytext == '&' || isalpha( (int) *yytext ) )\ {\ @@ -909,7 +909,7 @@ LANGUAGE_RULES_ARE { {\ DEBUG_INFO( printf( "Element \"%s\" is IDENTIFIER\n", yytext ) );\ \ - if( strlen( yytext ) > HB_SYMBOL_NAME_LEN )\ + if( iLen > HB_SYMBOL_NAME_LEN )\ {\ yytext[ HB_SYMBOL_NAME_LEN ] = '\0';\ yyleng = HB_SYMBOL_NAME_LEN;\ @@ -986,7 +986,7 @@ LANGUAGE_RULES_ARE { if( tmpPtr )\ {\ yylval.valDouble.bDec = strlen( tmpPtr + 1 );\ - yylval.valDouble.bWidth = strlen( yytext ) - yylval.valDouble.bDec;\ + yylval.valDouble.bWidth = iLen - yylval.valDouble.bDec;\ if( yylval.valDouble.bDec )\ {\ yylval.valDouble.bWidth--;\ @@ -1010,7 +1010,7 @@ LANGUAGE_RULES_ARE { }\ else\ {\ - yylval.valDouble.bWidth = strlen( yytext ) + 1;\ + yylval.valDouble.bWidth = iLen + 1;\ yylval.valDouble.bDec = 0;\ yylval.valDouble.szValue = yytext;\ iRet = NUM_DOUBLE;\ diff --git a/harbour/source/compiler/simplex.c b/harbour/source/compiler/simplex.c index 8993aa018c..8d3f764fa8 100644 --- a/harbour/source/compiler/simplex.c +++ b/harbour/source/compiler/simplex.c @@ -1227,7 +1227,7 @@ YY_DECL bIgnoreWords = FALSE; #ifdef LEX_ABBREVIATE_KEYS - iWordLen = strlen( (char*) sToken ); + iWordLen = iLen; if( iWordLen < LEX_ABBREVIATE_KEYS ) { @@ -1287,7 +1287,7 @@ YY_DECL else { #ifdef LEX_ABBREVIATE_WORDS - iWordLen = strlen( (char*) sToken ); + iWordLen = iLen; if( iWordLen < LEX_ABBREVIATE_WORDS ) { diff --git a/harbour/source/macro/macro.slx b/harbour/source/macro/macro.slx index f99f9be7f0..510d0c1f06 100644 --- a/harbour/source/macro/macro.slx +++ b/harbour/source/macro/macro.slx @@ -242,7 +242,7 @@ LANGUAGE_RULES_ARE { #undef ELEMENT_TOKEN #define ELEMENT_TOKEN(x)\ { yytext = x;\ - yyleng = strlen( yytext );\ + yyleng = iLen;\ \ if( *yytext == '_' || *yytext == '&' || isalpha( (int) *yytext ) )\ {\ @@ -297,7 +297,7 @@ LANGUAGE_RULES_ARE { }\ else\ {\ - if( ( USHORT ) strlen( yytext ) > YYLEX_PARAM->uiNameLen )\ + if( iLen > YYLEX_PARAM->uiNameLen )\ {\ yytext[ YYLEX_PARAM->uiNameLen ] = '\0';\ yyleng = YYLEX_PARAM->uiNameLen;\ @@ -341,7 +341,7 @@ LANGUAGE_RULES_ARE { if( tmpPtr )\ {\ yylval_ptr->valDouble.bDec = strlen( tmpPtr + 1 );\ - yylval_ptr->valDouble.bWidth = strlen( yytext ) - yylval_ptr->valDouble.bDec;\ + yylval_ptr->valDouble.bWidth = iLen - yylval_ptr->valDouble.bDec;\ if( yylval_ptr->valDouble.bDec )\ {\ yylval_ptr->valDouble.bWidth--;\ @@ -359,7 +359,7 @@ LANGUAGE_RULES_ARE { }\ else\ {\ - yylval_ptr->valDouble.bWidth = strlen( yytext ) + 1;\ + yylval_ptr->valDouble.bWidth = iLen + 1;\ yylval_ptr->valDouble.bDec = 0;\ yylval_ptr->valDouble.szValue = yytext;\ iRet = NUM_DOUBLE;\