/* * Copyright (C) 2000-2001 Marc Wandschneider * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation. * * For more information look at the file COPYRIGHT in this package * */ #ifndef _LALLOC_H_ #ifdef K_DEBUG /** * function prototypes */ #define localAlloc(s) localAllocImpl(__FILE__, __LINE__, (s)) #define localReAlloc(p, s) localReAllocImpl(__FILE__, __LINE__, (p), (s)) #define localFree(ptr) localFreeImpl(__FILE__, __LINE__, (void *)(ptr)) /** * Use these functions all the time !!! */ BOOL lallocInit(); // this should be nearly 1st call in program void lallocTerm(); // this should be near last call in program void *localAllocImpl(char *, int, size_t); void localFreeImpl(const char *, int, void *); void *localReAllocImpl(char *, int, void *, size_t); #else // K_DEBUG #include #define lallocInit() #define lallocTerm() #define localAlloc(s) malloc(s) #define localFree(p) free((void *)p) #define localReAlloc(p, s) realloc((p), (s)) #endif // K_DEBUG /** * makes sure the given buffer is big enough for the requested size. */ bool ensureBufferSize(char **checkMe, int *myMaxSize, int neededSize, int incr); #define _LALLOC_H_ #endif // _LALLOC_H_