new hb_xsize() function needed for classes.c DictRealloc() implementation.

This commit is contained in:
Antonio Linares
1999-07-19 17:21:27 +00:00
parent 6226aad741
commit 614a76075f
4 changed files with 21 additions and 7 deletions

View File

@@ -1,3 +1,10 @@
19990719-18:33 Antonio Linares <alinares@fivetech.com>
* 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 <rglab@imid.med.pl>
*source/compiler/harbour.y
-removed call for non ANSI C 'stricmp'
@@ -21,7 +28,7 @@
19990719-16:00 GMT+2 Ryszard Glab <rglab@imid.med.pl>
*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 <Gonzalo.Diethelm@jda.cl>
* 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()).

View File

@@ -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 );

View File

@@ -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 );
}

View File

@@ -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 ) );
}