KpHandle_t allocBufferHandlePrv (KpInt32_t numBytes) { KpInt32_t *Ptr; Ptr = (KpInt32_t *) malloc ((unsigned int)numBytes+HEADER); if (Ptr != NULL) { *Ptr = numBytes; /* store the number of bytes allocated */ Ptr += DLWORD; MemLogAlloc (Ptr, numBytes); } return (Ptr); }
/* PTMemTest checks whether there is a reasonable amount of memory still available */ KpInt32_t PTMemTest(void) { KpHandle_t theBuffer; #if defined (KPMAC) theBuffer = NewHandle (MINPTMEMSIZE); /* do not want temp mem in this case */ MemLogAlloc (theBuffer, MINPTMEMSIZE); #else theBuffer = allocBufferHandle (MINPTMEMSIZE); #endif if (theBuffer == NULL) { return (0); } else { freeBuffer (theBuffer); return (1); } }