mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-29 12:40:58 +00:00
Clean up z_zone.h's function protos to look more readable like m_random.h, don't name functions with "2" if not using PARANOIA or ZDEBUG
also, Z_Malloc/Calloc/Realloc are now macros of the "Align" versions, regardless of ZDEBUG or not
This commit is contained in:
parent
306cbc43e2
commit
836bf5e12f
2 changed files with 21 additions and 36 deletions
|
@ -541,7 +541,7 @@ void Z_CheckHeap(INT32 i)
|
|||
#ifdef PARANOIA
|
||||
void Z_ChangeTag2(void *ptr, INT32 tag, const char *file, INT32 line)
|
||||
#else
|
||||
void Z_ChangeTag2(void *ptr, INT32 tag)
|
||||
void Z_ChangeTag(void *ptr, INT32 tag)
|
||||
#endif
|
||||
{
|
||||
memblock_t *block;
|
||||
|
@ -675,7 +675,7 @@ char *Z_StrDup(const char *s)
|
|||
#ifdef PARANOIA
|
||||
void Z_SetUser2(void *ptr, void **newuser, const char *file, INT32 line)
|
||||
#else
|
||||
void Z_SetUser2(void *ptr, void **newuser)
|
||||
void Z_SetUser(void *ptr, void **newuser)
|
||||
#endif
|
||||
{
|
||||
memblock_t *block;
|
||||
|
|
53
src/z_zone.h
53
src/z_zone.h
|
@ -62,60 +62,45 @@ void Z_Init(void);
|
|||
void Z_FreeTags(INT32 lowtag, INT32 hightag);
|
||||
void Z_CheckMemCleanup(void);
|
||||
void Z_CheckHeap(INT32 i);
|
||||
#ifdef PARANOIA
|
||||
void Z_ChangeTag2(void *ptr, INT32 tag, const char *file, INT32 line);
|
||||
#else
|
||||
void Z_ChangeTag2(void *ptr, INT32 tag);
|
||||
#endif
|
||||
|
||||
#ifdef PARANOIA
|
||||
// This is used to get the local FILE : LINE info from CPP
|
||||
// prior to really call the function in question.
|
||||
//
|
||||
#define Z_ChangeTag(p,t) Z_ChangeTag2(p, t, __FILE__, __LINE__)
|
||||
#define Z_SetUser(p,u) Z_SetUser2(p, u, __FILE__, __LINE__)
|
||||
void Z_ChangeTag2(void *ptr, INT32 tag, const char *file, INT32 line);
|
||||
void Z_SetUser2(void *ptr, void **newuser, const char *file, INT32 line);
|
||||
#else
|
||||
void Z_SetUser2(void *ptr, void **newuser);
|
||||
void Z_ChangeTag(void *ptr, INT32 tag);
|
||||
void Z_SetUser(void *ptr, void **newuser);
|
||||
#endif
|
||||
|
||||
#ifdef ZDEBUG
|
||||
#define Z_Free(p) Z_Free2(p, __FILE__, __LINE__)
|
||||
void Z_Free2(void *ptr, const char *file, INT32 line);
|
||||
#define Z_Malloc(s,t,u) Z_Malloc2(s, t, u, 0, __FILE__, __LINE__)
|
||||
#define Z_MallocAlign(s,t,u,a) Z_Malloc2(s, t, u, a, __FILE__, __LINE__)
|
||||
void *Z_Malloc2(size_t size, INT32 tag, void *user, INT32 alignbits, const char *file, INT32 line) FUNCALLOC(1);
|
||||
#define Z_Calloc(s,t,u) Z_Calloc2(s, t, u, 0, __FILE__, __LINE__)
|
||||
#define Z_CallocAlign(s,t,u,a) Z_Calloc2(s, t, u, a, __FILE__, __LINE__)
|
||||
void *Z_Calloc2(size_t size, INT32 tag, void *user, INT32 alignbits, const char *file, INT32 line) FUNCALLOC(1);
|
||||
#define Z_Realloc(p,s,t,u) Z_Realloc2(p, s, t, u, 0, __FILE__, __LINE__)
|
||||
#define Z_Free(p) Z_Free2(p, __FILE__, __LINE__)
|
||||
#define Z_MallocAlign(s,t,u,a) Z_Malloc2(s, t, u, a, __FILE__, __LINE__)
|
||||
#define Z_CallocAlign(s,t,u,a) Z_Calloc2(s, t, u, a, __FILE__, __LINE__)
|
||||
#define Z_ReallocAlign(p,s,t,u,a) Z_Realloc2(p,s, t, u, a, __FILE__, __LINE__)
|
||||
void Z_Free2(void *ptr, const char *file, INT32 line);
|
||||
void *Z_Malloc2(size_t size, INT32 tag, void *user, INT32 alignbits, const char *file, INT32 line) FUNCALLOC(1);
|
||||
void *Z_Calloc2(size_t size, INT32 tag, void *user, INT32 alignbits, const char *file, INT32 line) FUNCALLOC(1);
|
||||
void *Z_Realloc2(void *ptr, size_t size, INT32 tag, void *user, INT32 alignbits, const char *file, INT32 line) FUNCALLOC(2);
|
||||
#else
|
||||
void Z_Free(void *ptr);
|
||||
void *Z_MallocAlign(size_t size, INT32 tag, void *user, INT32 alignbits) FUNCALLOC(1);
|
||||
#define Z_Malloc(s,t,u) Z_MallocAlign(s, t, u, 0)
|
||||
void *Z_CallocAlign(size_t size, INT32 tag, void *user, INT32 alignbits) FUNCALLOC(1);
|
||||
#define Z_Calloc(s,t,u) Z_CallocAlign(s, t, u, 0)
|
||||
void *Z_ReallocAlign(void *ptr, size_t size, INT32 tag, void *user, INT32 alignbits) FUNCALLOC(2) ;
|
||||
#define Z_Realloc(p, s,t,u) Z_ReallocAlign(p, s, t, u, 0)
|
||||
void *Z_ReallocAlign(void *ptr, size_t size, INT32 tag, void *user, INT32 alignbits) FUNCALLOC(2);
|
||||
#endif
|
||||
|
||||
#define Z_Malloc(s,t,u) Z_MallocAlign(s, t, u, 0)
|
||||
#define Z_Calloc(s,t,u) Z_CallocAlign(s, t, u, 0)
|
||||
#define Z_Realloc(p,s,t,u) Z_ReallocAlign(p, s, t, u, 0)
|
||||
|
||||
size_t Z_TagUsage(INT32 tagnum);
|
||||
size_t Z_TagsUsage(INT32 lowtag, INT32 hightag);
|
||||
|
||||
char *Z_StrDup(const char *in);
|
||||
|
||||
// This is used to get the local FILE : LINE info from CPP
|
||||
// prior to really call the function in question.
|
||||
//
|
||||
#ifdef PARANOIA
|
||||
#define Z_ChangeTag(p,t) Z_ChangeTag2(p, t, __FILE__, __LINE__)
|
||||
#else
|
||||
#define Z_ChangeTag(p,t) Z_ChangeTag2(p, t)
|
||||
#endif
|
||||
|
||||
#ifdef PARANOIA
|
||||
#define Z_SetUser(p,u) Z_SetUser2(p, u, __FILE__, __LINE__)
|
||||
#else
|
||||
#define Z_SetUser(p,u) Z_SetUser2(p, u)
|
||||
#endif
|
||||
|
||||
#define Z_Unlock(p) (void)p
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue