diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 4cc1efc021..66e0adb312 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,10 @@ +19991111-12:02 GMT+1 Victor Szel + * source/vm/dymsym.c + % hb_dynsymGet(), hb_dynsymFindName() - Optimized and fixed the uppercase + conversion, now it's really faster a bit. (tested) + * include/hbsetup.h + * Symbol name length changed to 63 from 128. + 19991111-10:45 GMT+1 Victor Szel * source/rtl/fm.c ! Two casts added to hb_xrealloc(). diff --git a/harbour/include/hbsetup.h b/harbour/include/hbsetup.h index 4e1776fe63..fd8a6fa45a 100644 --- a/harbour/include/hbsetup.h +++ b/harbour/include/hbsetup.h @@ -161,11 +161,11 @@ * You can set here the maximum symbol name length handled by Harbour * compiler and runtime. You can override this setting in the make process. * - * By default this value is 128 + * By default this value is 63 */ #ifndef HB_SYMBOL_NAME_LEN - #define HB_SYMBOL_NAME_LEN 128 + #define HB_SYMBOL_NAME_LEN 63 #endif /* *********************************************************************** diff --git a/harbour/source/vm/dynsym.c b/harbour/source/vm/dynsym.c index 825bc0c05a..2cfd99638e 100644 --- a/harbour/source/vm/dynsym.c +++ b/harbour/source/vm/dynsym.c @@ -33,6 +33,8 @@ * */ +#include + #include "extend.h" #define SYM_ALLOCATED ( ( HB_SYMBOLSCOPE ) -1 ) @@ -135,8 +137,20 @@ PHB_DYNS hb_dynsymGet( char * szName ) /* finds and creates a symbol if not fou HB_TRACE(HB_TR_DEBUG, ("hb_dynsymGet(%s)", szName)); - /* make a copy as we may get a const string, the turn it to uppercase */ - pDynSym = hb_dynsymFind( hb_strncpyUpper( szUprName, szName, HB_SYMBOL_NAME_LEN ) ); + /* make a copy as we may get a const string, then turn it to uppercase */ + { + ULONG ulLen = strlen( szName ); + char * pDest = szUprName; + + if( ulLen > HB_SYMBOL_NAME_LEN ) + ulLen = HB_SYMBOL_NAME_LEN; + + pDest[ ulLen ] = '\0'; + while( ulLen-- ) + *pDest++ = toupper( *szName++ ); + } + + pDynSym = hb_dynsymFind( szUprName ); if( ! pDynSym ) /* Does it exists ? */ pDynSym = hb_dynsymNew( hb_symbolNew( szUprName ) ); /* Make new symbol */ @@ -150,8 +164,20 @@ PHB_DYNS hb_dynsymFindName( char * szName ) /* finds a symbol */ HB_TRACE(HB_TR_DEBUG, ("hb_dynsymFindName(%s)", szName)); - /* make a copy as we may get a const string */ - pDynSym = hb_dynsymFind( hb_strncpyUpper( szUprName, szName, HB_SYMBOL_NAME_LEN ) ); + /* make a copy as we may get a const string, then turn it to uppercase */ + { + ULONG ulLen = strlen( szName ); + char * pDest = szUprName; + + if( ulLen > HB_SYMBOL_NAME_LEN ) + ulLen = HB_SYMBOL_NAME_LEN; + + pDest[ ulLen ] = '\0'; + while( ulLen-- ) + *pDest++ = toupper( *szName++ ); + } + + pDynSym = hb_dynsymFind( szUprName ); return pDynSym; } @@ -280,4 +306,3 @@ HARBOUR HB___DYNSGETINDEX( void ) /* Gimme index number of symbol: dsIndex = __d else hb_retnl( 0L ); } -