[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [freetype2] anuj-distance-field fdf4191: [sdf] Added memory tracker.
From: |
Werner LEMBERG |
Subject: |
Re: [freetype2] anuj-distance-field fdf4191: [sdf] Added memory tracker. |
Date: |
Sat, 18 Jul 2020 07:11:51 +0200 (CEST) |
> How is this:
> https://lists.nongnu.org/archive/html/freetype-commit/2020-07/msg00067.html
> ?
Nice! However, I think it's better to have two versions of
`SFD_ALLOC` and `SFD_FREE` depending on whether debugging is enabled
or not. There should be zero overhead for the non-debugging case.
Having two versions would also allow to use a function internally so
that you can (a) avoid the `do {} while (0)` construction, and (b)
still use the macro within a conditional. I imagine something like
the following sketch.
#ifdef DEBUGGING
typedef struct SDF_MemoryUser_ { ... } ...
FT_Pointer
sdf_alloc(...)
{
...
}
#define SDF_ALLOC ...
#else
#define SDF_ALLOC FT_QALLOC
#endif
Werner