xp_comm_proj/rd_dicom/Papyrus3/PapyEallocPC3.c
/*******************************************************************************/
/*									       */
/*	erealloc3 : checked version of realloc				       */
/*	return : the validated pointer if OK				       */
/*									       */
/*******************************************************************************/
erealloc3 : checked version of realloc
return : the validated pointer if OK
erealloc3 : checked version of realloc return : the validated pointer if OK
void *
erealloc3 (void *ptr, PapyULong size)
{
#ifdef GB_ALLOC
    HGLOBAL hglb;
	DWORD dw;
#ifdef _WIN16_
	dw = GlobalHandle (SELECTOROF(ptr));
	hglb = (HGLOBAL) (LOWORD (dw));
#else
	hglb = GlobalHandle (ptr);
#endif
	GlobalUnlock (hglb);
	hglb = GlobalReAlloc (hglb, size, GMEM_ZEROINIT | GMEM_MOVEABLE);
	ptr = GlobalLock (hglb);
	return checkvp3 (ptr);
#else
	return checkvp3 (realloc (ptr, (size_t)size));
#endif
}
void * erealloc3 ( void * ptr , PapyULong size ) { #ifdef GB_ALLOC HGLOBAL hglb ; DWORD dw ; #ifdef _WIN16_ dw = GlobalHandle ( SELECTOROF ( ptr ) ) ; hglb = ( HGLOBAL ) ( LOWORD ( dw ) ) ; #else hglb = GlobalHandle ( ptr ) ; #endif GlobalUnlock ( hglb ) ; hglb = GlobalReAlloc ( hglb , size , GMEM_ZEROINIT | GMEM_MOVEABLE ) ; ptr = GlobalLock ( hglb ) ; return checkvp3 ( ptr ) ; #else return checkvp3 ( realloc ( ptr , ( size_t ) size ) ) ; #endif }
erealloc3 : checked version of realloc
return : the validated pointer if OK
erealloc3 : checked version of realloc return : the validated pointer if OK