summaryrefslogtreecommitdiffstats
path: root/src/misc/util
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2014-12-03 20:35:39 -0800
committerAlan Mishchenko <alanmi@berkeley.edu>2014-12-03 20:35:39 -0800
commit705006a64830a4b08bce2310d3c118e47770ad7c (patch)
treea73fb8b5d18d786ccaad055594c6afa7e54d98f0 /src/misc/util
parente970aa8521002b242deb259690d1cad67367fb11 (diff)
downloadabc-705006a64830a4b08bce2310d3c118e47770ad7c.tar.gz
abc-705006a64830a4b08bce2310d3c118e47770ad7c.tar.bz2
abc-705006a64830a4b08bce2310d3c118e47770ad7c.zip
Changes to the parser.
Diffstat (limited to 'src/misc/util')
-rw-r--r--src/misc/util/utilNam.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/misc/util/utilNam.c b/src/misc/util/utilNam.c
index 76c86aff..96c3b283 100644
--- a/src/misc/util/utilNam.c
+++ b/src/misc/util/utilNam.c
@@ -257,7 +257,7 @@ int Abc_NamStrHash( const char * pStr, const char * pLim, int nTableSize )
unsigned i, uHash;
if ( pLim )
{
- for ( uHash = 0, i = 0; pStr < pLim; i++ )
+ for ( uHash = 0, i = 0; pStr+i < pLim; i++ )
if ( i & 1 )
uHash *= pStr[i] * s_FPrimes[i & 0x7F];
else
@@ -285,6 +285,23 @@ int Abc_NamStrHash( const char * pStr, const char * pLim, int nTableSize )
SeeAlso []
***********************************************************************/
+static inline int Abc_NamStrcmp( char * pStr, char * pLim, char * pThis )
+{
+ if ( pLim )
+ {
+ while ( pStr < pLim )
+ if ( *pStr++ != *pThis++ )
+ return 1;
+ return *pThis != '\0';
+ }
+ else
+ {
+ while ( *pStr )
+ if ( *pStr++ != *pThis++ )
+ return 1;
+ return *pThis != '\0';
+ }
+}
static inline int * Abc_NamStrHashFind( Abc_Nam_t * p, const char * pStr, const char * pLim )
{
char * pThis;
@@ -293,7 +310,7 @@ static inline int * Abc_NamStrHashFind( Abc_Nam_t * p, const char * pStr, const
for ( pThis = (*pPlace)? Abc_NamIntToStr(p, *pPlace) : NULL;
pThis; pPlace = Abc_NamIntToNextP(p, *pPlace),
pThis = (*pPlace)? Abc_NamIntToStr(p, *pPlace) : NULL )
- if ( !strcmp( pStr, pThis ) )
+ if ( !Abc_NamStrcmp( (char *)pStr, (char *)pLim, pThis ) )
break;
return pPlace;
}