From 2de3cd4a33d8436a78e529699e6d374bf537a488 Mon Sep 17 00:00:00 2001 From: Paul Tucker Date: Sat, 11 Sep 1999 06:18:24 +0000 Subject: [PATCH] *** empty log message *** --- harbour/ChangeLog | 7 +++++++ harbour/source/compiler/harbour.y | 9 ++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 564cdd232e..4caceb4727 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,10 @@ +19990911-01:42 EDT Paul Tucker + * source/compiler/harbour.y + sz_Compare4() Change the length of the first compare to + Min( 4, len(string)) to account for strings shorter than 4. + Add 1 to the length in the second compare to include the trailing + null so that (ie:) SetPos and SetPosBS can be detected as unique. + 19990910-18:45 EDT David G. Holm * tests/working/rtl_test.prg ! Changed smart stringify token marker in TEST_LINE to regular diff --git a/harbour/source/compiler/harbour.y b/harbour/source/compiler/harbour.y index 6431b418ba..7993fa7ebe 100644 --- a/harbour/source/compiler/harbour.y +++ b/harbour/source/compiler/harbour.y @@ -437,12 +437,15 @@ static const char * _szReservedFun[] = { */ int EXTERNAL_LINKAGE sz_compare4( const void * pLookup, const void * pReserved ) { - int iCmp; + int iCmp, iSlen; - iCmp = strncmp( ( const char * ) pLookup, * ( ( const char * * ) pReserved ), 4 ); + iSlen = strlen( ( const char * ) pLookup ); + + iCmp = strncmp( ( const char * ) pLookup, * ( ( const char * * ) pReserved ), + ( iSlen && iSlen < 4 ) ? iSlen : 4 ); if( iCmp == 0 ) iCmp = strncmp( ( const char * ) pLookup, * ( ( const char * * ) pReserved ), - strlen( ( const char * ) pLookup ) ); + iSlen + 1); return iCmp; }