Click here to Skip to main content
15,884,353 members
Articles / Containers / Virtual Machine

An extendable report editor

Rate me:
Please Sign up or sign in to vote.
5.00/5 (11 votes)
3 Sep 2008CPOL3 min read 40.9K   2K   35  
An extendable report editor. You can simply add your own controls without recompiling the program or writing annoying plug-ins.
/*
**************************************
* This is header file Created by
* autocode generator.
* This tools is made by ChenXiangPeng
**************************************
*/

#ifndef __MEM_TOOL_2007_6_27_16_17_29_H
#define __MEM_TOOL_2007_6_27_16_17_29_H

#include "common.h"
#include "assert.h"

int Mem_Tool_Init(void);
int Mem_Tool_Destroy(void);
int _leak_printf(char *szFormat, ...);

#ifdef _DEBUG_
#define LEAK_DETECT_PRINT _leak_printf
#else
#define LEAK_DETECT_PRINT
#endif

#define NEW(p,obj)  p = new obj;\
{\
ASSERT(p);\
LEAK_DETECT_PRINT("alloc: addr=0x%x file=%s line=%d obj = %s",p,__FILE__,__LINE__,#obj);\
}\

#define NEW_ARRAY(p,obj,items) p = new obj[items];\
{\
ASSERT(p);\
LEAK_DETECT_PRINT("alloc: addr=0x%x file=%s line=%d obj = %s",p,__FILE__,__LINE__,#obj);\
}\

#define DEL(p) if(p)\
{\
delete p;\
LEAK_DETECT_PRINT("free: addr=0x%x file=%s line=%d",p,__FILE__,__LINE__);\
p = NULL;\
}\

#define DEL_ARRAY(p) if(p)\
{\
delete [] p;\
LEAK_DETECT_PRINT("free: addr=0x%x file=%s line=%d",p,__FILE__,__LINE__);\
p = NULL;\
}\

#define MALLOC(p,obj,items) p = (obj*)malloc(sizeof(obj)*items);\
{\
ASSERT(p);\
LEAK_DETECT_PRINT("alloc: addr=0x%x file=%s line=%d obj = %s",p,__FILE__,__LINE__,#obj);\
}\

#define FREE(p) if(p)\
{\
free(p);\
LEAK_DETECT_PRINT("free: addr=0x%x file=%s line=%d",p,__FILE__,__LINE__);\
p = NULL;\
}\

#define REALLOC(p,obj,items) if(p)\
{\
LEAK_DETECT_PRINT("free: addr=0x%x file=%s line=%d",p,__FILE__,__LINE__);\
p = (obj*)realloc(p,sizeof(obj)*items);\
ASSERT(p);\
LEAK_DETECT_PRINT("alloc: addr=0x%x file=%s line=%d obj = %s",p,__FILE__,__LINE__,#obj);\
}\

#endif

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
China China
26 years old, 2 years work experience.

Comments and Discussions