diff --git a/harbour/ChangeLog b/harbour/ChangeLog index e387448ba1..2c6b3129ac 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,10 @@ +19990719-18:33 Antonio Linares + * source/rtl/classes.c + * enhanced methods amount meanwhile DictRealloc() is built. + * several defines missing. + * source/rtl/extend.c + * new hb_xsize() function needed for classes.c DictRealloc() implementation. + 19990719-18:30 GMT+2 Ryszard Glab *source/compiler/harbour.y -removed call for non ANSI C 'stricmp' @@ -21,7 +28,7 @@ 19990719-16:00 GMT+2 Ryszard Glab *source/rtl/msgxxx.c +added support for Polish national messages - + *source/rtl/natmsg/msgpl852.c *source/rtl/natmsg/msgplmaz.c * corrected names of months @@ -223,7 +230,7 @@ Fri Jul 16 17:53:35 1999 Gonzalo A. Diethelm - * source/rtl/gt/gtwin.c: + * source/rtl/gt/gtwin.c: Added the possibility to log everything to a file; this made it possible for me to find out what was wrong with GTwin (which is, noone was calling gtInit()). diff --git a/harbour/include/extend.h b/harbour/include/extend.h index 22ac4420df..ac2a17c86f 100644 --- a/harbour/include/extend.h +++ b/harbour/include/extend.h @@ -257,6 +257,7 @@ void hb_reta( ULONG ulLen ); /* returns an array with a specific length */ void * hb_xgrab( ULONG lSize ); /* allocates memory */ void * hb_xrealloc( void * pMem, ULONG lSize ); /* reallocates memory */ void hb_xfree( void * pMem ); /* frees memory */ +ULONG hb_xsize( void * pMem ); /* returns the size of an allocated memory block */ void ItemCopy( PHB_ITEM pDest, PHB_ITEM pSource ); void ItemRelease( PHB_ITEM pItem ); diff --git a/harbour/source/rtl/classes.c b/harbour/source/rtl/classes.c index baaba50d40..301e54de25 100644 --- a/harbour/source/rtl/classes.c +++ b/harbour/source/rtl/classes.c @@ -78,7 +78,9 @@ typedef struct PHB_ITEM pInlines; /* Array for inline codeblocks */ } CLASS, * PCLASS; -#define BUCKET 4 +#define BASE_METHODS 200 +#define BUCKET 4 +#define HASH_KEY BASE_METHODS/BUCKET extern STACK stack; extern SYMBOL symEval; @@ -324,14 +326,14 @@ HARBOUR HB_CLASSCREATE(void) { pNewCls->wDatas = hb_parni( 2 ); pNewCls->wDataFirst = 0; - pNewCls->pMethods = ( PMETHOD ) hb_xgrab( 100 * sizeof( METHOD ) ); + pNewCls->pMethods = ( PMETHOD ) hb_xgrab( BASE_METHODS * sizeof( METHOD ) ); pNewCls->wMethods = 0; - pNewCls->wHashKey = 25; /* BUCKET = 4 repetitions */ + pNewCls->wHashKey = HASH_KEY; /* BUCKET = 4 repetitions */ pNewCls->pClassDatas = hb_itemArrayNew( 0 ); pNewCls->pInlines = hb_itemArrayNew( 0 ); - memset( pNewCls->pMethods, 0, 100 * sizeof( METHOD ) ); + memset( pNewCls->pMethods, 0, BASE_METHODS * sizeof( METHOD ) ); } hb_retni( ++wClasses ); } @@ -1099,4 +1101,3 @@ HARBOUR HB___WDATAS(void) hb_retni( pClasses[ wClass - 1 ].wDatas ); } - diff --git a/harbour/source/rtl/extend.c b/harbour/source/rtl/extend.c index 499b371f9e..eb89b43714 100644 --- a/harbour/source/rtl/extend.c +++ b/harbour/source/rtl/extend.c @@ -926,3 +926,8 @@ void hb_xfree( void * pMem ) /* frees fixed memory */ ulMemoryConsumed -= ulMemSize; ulMemoryBlocks--; } + +ULONG hb_xsize( void * pMem ) /* returns the size of an allocated memory block */ +{ + return * ( ULONG * ) ( ( char * ) pMem - sizeof( ULONG ) ); +}