Patch by Stefan Huehner: "string 1"
Replace all STRING with char or const char. git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@716 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
02ee180072
commit
a88bbc0c37
|
@ -39,8 +39,8 @@
|
|||
#define MEMORY_SET TRUE
|
||||
|
||||
// the filename and line number of the last call to the block functions
|
||||
STRING *pCallFileName;
|
||||
SDWORD callLine;
|
||||
static const char *pCallFileName;
|
||||
static SDWORD callLine;
|
||||
|
||||
// the list of allocated blocks
|
||||
static BLOCK_HEAP *psBlockList=NULL;
|
||||
|
@ -73,7 +73,7 @@ void blkShutDown(void)
|
|||
}
|
||||
|
||||
// Note the call position for a blkAlloc or blkFree
|
||||
void blkCallPos(STRING *pFileName, SDWORD line)
|
||||
void blkCallPos(const char *pFileName, SDWORD line)
|
||||
{
|
||||
pCallFileName = pFileName;
|
||||
callLine = line;
|
||||
|
|
|
@ -34,11 +34,11 @@ typedef struct _block_heap
|
|||
SDWORD init, ext; // initial and extension block sizes
|
||||
BLOCK_HEAP_MEM *psBlocks;
|
||||
#ifdef DEBUG_BLOCK
|
||||
STRING *pFileName;
|
||||
const char *pFileName;
|
||||
SDWORD line;
|
||||
MEM_NODE *psMemTreap; // treap of the memory blocks
|
||||
BOOL free; // whether free has been called for this block
|
||||
STRING *pFreeFile; // where the last free was called from
|
||||
const char *pFreeFile; // where the last free was called from
|
||||
SDWORD freeLine;
|
||||
UDWORD TotalAllocated; // Total amount of bytes used in the block (sum of all alloc's)
|
||||
#endif
|
||||
|
@ -82,7 +82,7 @@ extern BOOL blkPointerValid(BLOCK_HEAP *psHeap, void *pData, SDWORD size);
|
|||
extern BOOL blkPointerValidAll(void *pData, SDWORD size);
|
||||
|
||||
// Note the call position for a blkAlloc or blkFree
|
||||
extern void blkCallPos(STRING *pFileName, SDWORD line);
|
||||
extern void blkCallPos(const char *pFileName, SDWORD line);
|
||||
|
||||
void blkPrintDetails(BLOCK_HEAP *psHeap);
|
||||
void blkReport(void);
|
||||
|
|
|
@ -177,7 +177,7 @@ UINT HashStringIgnoreCase( const char *String );
|
|||
|
||||
/* Endianness hacks */
|
||||
|
||||
static __inline void endian_uword(UWORD *uword) {
|
||||
static inline void endian_uword(UWORD *uword) {
|
||||
#ifdef __BIG_ENDIAN__
|
||||
UBYTE tmp, *ptr;
|
||||
|
||||
|
@ -188,7 +188,7 @@ static __inline void endian_uword(UWORD *uword) {
|
|||
#endif
|
||||
}
|
||||
|
||||
static __inline void endian_sword(SWORD *sword) {
|
||||
static inline void endian_sword(SWORD *sword) {
|
||||
#ifdef __BIG_ENDIAN__
|
||||
UBYTE tmp, *ptr;
|
||||
|
||||
|
@ -199,7 +199,7 @@ static __inline void endian_sword(SWORD *sword) {
|
|||
#endif
|
||||
}
|
||||
|
||||
static __inline void endian_udword(UDWORD *udword) {
|
||||
static inline void endian_udword(UDWORD *udword) {
|
||||
#ifdef __BIG_ENDIAN__
|
||||
UBYTE tmp, *ptr;
|
||||
|
||||
|
@ -213,7 +213,7 @@ static __inline void endian_udword(UDWORD *udword) {
|
|||
#endif
|
||||
}
|
||||
|
||||
static __inline void endian_sdword(SDWORD *sdword) {
|
||||
static inline void endian_sdword(SDWORD *sdword) {
|
||||
#ifdef __BIG_ENDIAN__
|
||||
UBYTE tmp, *ptr;
|
||||
|
||||
|
@ -227,7 +227,7 @@ static __inline void endian_sdword(SDWORD *sdword) {
|
|||
#endif
|
||||
}
|
||||
|
||||
static __inline void endian_fract(FRACT *fract) {
|
||||
static inline void endian_fract(FRACT *fract) {
|
||||
#ifdef __BIG_ENDIAN__
|
||||
UBYTE tmp, *ptr;
|
||||
|
||||
|
|
|
@ -145,7 +145,7 @@ SDWORD memBlockCmp(UDWORD key1, UDWORD key2)
|
|||
* A buffer is also allocated at the top and bottom of the memory to check for
|
||||
* overwrites.
|
||||
*/
|
||||
void *memMalloc(STRING *pFileName, SDWORD LineNumber, size_t Size)
|
||||
void *memMalloc(const char *pFileName, SDWORD LineNumber, size_t Size)
|
||||
{
|
||||
void *pMemBase;
|
||||
MEM_NODE *psNode;
|
||||
|
@ -172,7 +172,7 @@ void *memMalloc(STRING *pFileName, SDWORD LineNumber, size_t Size)
|
|||
|
||||
/* Got the main bit of memory - set up the node entry */
|
||||
psNode = (MEM_NODE *)pMemBase;
|
||||
psNode->pFile = (STRING *)RMALLOC( strlen(pFileName)+1 );
|
||||
psNode->pFile = (char *)RMALLOC( strlen(pFileName)+1 );
|
||||
if (!psNode->pFile)
|
||||
{
|
||||
RFREE(pMemBase);
|
||||
|
@ -229,7 +229,7 @@ void *memMallocRelease(size_t Size)
|
|||
* All memory is reset to FREE_BYTE before freeing to avoid using
|
||||
* freed memory.
|
||||
*/
|
||||
void memFree(STRING *pFileName, SDWORD LineNumber, void *pMemToFree)
|
||||
void memFree(const char *pFileName, SDWORD LineNumber, void *pMemToFree)
|
||||
{
|
||||
MEM_NODE sNode, *psDeleted;
|
||||
SDWORD i, InvalidBottom, InvalidTop;
|
||||
|
@ -483,7 +483,7 @@ void memMemoryDump(MEM_NODE *Node)
|
|||
* If pFileName is not NULL send the report to the specified file.
|
||||
* If pFileName is NULL the report goes to DBPRINTF
|
||||
*/
|
||||
void memMemoryReport(STRING *pFileName)
|
||||
void memMemoryReport(const char *pFileName)
|
||||
{
|
||||
#ifdef DEBUG_MALLOC
|
||||
SDWORD TotMem;
|
||||
|
@ -511,7 +511,7 @@ void memMemoryReport(STRING *pFileName)
|
|||
|
||||
|
||||
/* Display the memory treap */
|
||||
void memDisplayTreap(STRING *pFileName)
|
||||
void memDisplayTreap(const char *pFileName)
|
||||
{
|
||||
#ifdef DEBUG_MALLOC
|
||||
debug(LOG_MEMORY, "Memory Allocation Treap:");
|
||||
|
|
|
@ -42,21 +42,21 @@ void memSetBlockHeap(struct _block_heap *psHeap);
|
|||
struct _block_heap *memGetBlockHeap(void);
|
||||
|
||||
/* malloc replacements */
|
||||
void *memMalloc(STRING *pFileName, SDWORD LineNumber, size_t Size);
|
||||
void *memMalloc(const char *pFileName, SDWORD LineNumber, size_t Size);
|
||||
void *memMallocRelease(size_t Size);
|
||||
|
||||
/* free replacements */
|
||||
void memFree(STRING *pFileName, SDWORD LineNumber, void *pMemToFree);
|
||||
void memFree(const char *pFileName, SDWORD LineNumber, void *pMemToFree);
|
||||
void memFreeRelease(void *pMemToFree);
|
||||
|
||||
/* Check a pointer refers to a valid block of memory */
|
||||
BOOL memPointerValid(void *pPtr, size_t Size);
|
||||
|
||||
/* Report on currently allocated memory */
|
||||
void memMemoryReport(STRING *pFileName);
|
||||
void memMemoryReport(const char *pFileName);
|
||||
|
||||
/* Display the memory treap */
|
||||
void memDisplayTreap(STRING *pFileName);
|
||||
void memDisplayTreap(const char *pFileName);
|
||||
|
||||
#ifdef DEBUG_MALLOC
|
||||
|
||||
|
|
|
@ -18,15 +18,15 @@
|
|||
|
||||
/* Position of the last call */
|
||||
static SDWORD cLine;
|
||||
static STRING *pCFile;
|
||||
static STRING pCFileNone[] = "None";
|
||||
static char *pCFile;
|
||||
static char pCFileNone[] = "None";
|
||||
|
||||
/* Store the location in C code at which a call to the heap was made */
|
||||
void treapSetCallPos(STRING *pFileName, SDWORD lineNumber)
|
||||
void treapSetCallPos(const char *pFileName, SDWORD lineNumber)
|
||||
{
|
||||
cLine = lineNumber;
|
||||
|
||||
pCFile = (STRING *)MALLOC(strlen(pFileName) + 1);
|
||||
pCFile = (char *)MALLOC(strlen(pFileName) + 1);
|
||||
if (pCFile)
|
||||
{
|
||||
strcpy(pCFile, pFileName);
|
||||
|
@ -57,8 +57,8 @@ static SDWORD defaultCmp(UDWORD key1, UDWORD key2)
|
|||
SDWORD treapStringCmp(UDWORD key1, UDWORD key2)
|
||||
{
|
||||
SDWORD result;
|
||||
STRING *pStr1 = (STRING *)key1;
|
||||
STRING *pStr2 = (STRING *)key2;
|
||||
const char *pStr1 = (const char *)key1;
|
||||
const char *pStr2 = (const char *)key2;
|
||||
|
||||
result = strcmp(pStr1,pStr2);
|
||||
if (result<0) return -1;
|
||||
|
|
|
@ -45,7 +45,7 @@ typedef SDWORD (*TREAP_CMP)(UDWORD key1, UDWORD key2);
|
|||
|
||||
/* The debug info */
|
||||
#define TREAP_NODE_DEBUG \
|
||||
STRING *pFile; /* file the node was created in */ \
|
||||
const char *pFile; /* file the node was created in */ \
|
||||
SDWORD line /* line the node was created at */
|
||||
|
||||
typedef struct _treap_node
|
||||
|
@ -66,7 +66,7 @@ typedef struct _treap
|
|||
TREAP_NODE *psRoot; // root of the tree
|
||||
|
||||
#ifdef DEBUG_TREAP
|
||||
STRING *pFile; // file the treap was created in
|
||||
const char *pFile; // file the treap was created in
|
||||
SDWORD line; // line the treap was created at
|
||||
#endif
|
||||
} TREAP;
|
||||
|
@ -78,7 +78,7 @@ typedef struct _treap
|
|||
|
||||
|
||||
/* Store the location in C code at which a call to the heap was made */
|
||||
extern void treapSetCallPos(STRING *pFileName, SDWORD lineNumber);
|
||||
extern void treapSetCallPos(const char *pFileName, SDWORD lineNumber);
|
||||
|
||||
/* Function type for object equality */
|
||||
//typedef BOOL (*TREAP_EQUAL)(void *pObj1, void *pObj2);
|
||||
|
|
Loading…
Reference in New Issue