Fix release compilation.

This commit is contained in:
jief 2023-11-08 14:56:43 +01:00
parent 42cece9885
commit 652c25fa69
3 changed files with 11 additions and 9 deletions

View File

@ -210,13 +210,7 @@ void nsvg__outputDanglingPtr()
} }
} }
#else #else
// When tracing allocation is not wanted (release version for exemple), we use macro. This way, the msg parameter is not compiled or evaluated. // Macros defined in header.
// It prevents all the literal do be compiled and stored in the produced file.
#define nsvg__alloc(size, msg) AllocatePool(size)
#define nsvg__alloczero(size, msg) AllocateZeroPool(size)
#define nsvg__alloccopy(size, ref, msg) AllocateCopyPool(size, ref)
#define nsvg__realloc(oldsize, newsize, ref, msg) ReallocatePool(oldsize, newsize, ref)
#define nsvg__delete(buffer, msg) FreePool(buffer)
#endif #endif

View File

@ -458,6 +458,14 @@ void* nsvg__realloc(UINTN oldsize, UINTN newsize, void* ref, const XString8& msg
void nsvg__delete(void* buffer, const XString8& msg); void nsvg__delete(void* buffer, const XString8& msg);
size_t nsvg__nbDanglingPtr(); size_t nsvg__nbDanglingPtr();
void nsvg__outputDanglingPtr(); void nsvg__outputDanglingPtr();
#else
// When tracing allocation is not wanted (release version for exemple), we use macro. This way, the msg parameter is not compiled or evaluated.
// It prevents all the literal do be compiled and stored in the produced file.
#define nsvg__alloc(size, msg) AllocatePool(size)
#define nsvg__alloczero(size, msg) AllocateZeroPool(size)
#define nsvg__alloccopy(size, ref, msg) AllocateCopyPool(size, ref)
#define nsvg__realloc(oldsize, newsize, ref, msg) ReallocatePool(oldsize, newsize, ref)
#define nsvg__delete(buffer, msg) FreePool(buffer)
#endif #endif
bool isShapeInGroup(NSVGshape* shape, const char* groupName); bool isShapeInGroup(NSVGshape* shape, const char* groupName);

View File

@ -194,7 +194,7 @@ static void nsvg__resetPool(NSVGrasterizer* r)
r->curpage = r->pages; r->curpage = r->pages;
} }
static UINT8* nsvg__alloc(NSVGrasterizer* r, int size) static UINT8* nsvgrast__alloc(NSVGrasterizer* r, int size)
{ {
UINT8* buf; UINT8* buf;
if (size > NSVG__MEMPAGE_SIZE) return NULL; if (size > NSVG__MEMPAGE_SIZE) return NULL;
@ -989,7 +989,7 @@ static NSVGactiveEdge* nsvg__addActive(NSVGrasterizer* r, NSVGedge* e, float sta
r->freelist = z->next; r->freelist = z->next;
} else { } else {
// Alloc new edge. // Alloc new edge.
z = (NSVGactiveEdge*)nsvg__alloc(r, sizeof(NSVGactiveEdge)); z = (NSVGactiveEdge*)nsvgrast__alloc(r, sizeof(NSVGactiveEdge));
if (z == NULL) return NULL; if (z == NULL) return NULL;
} }