tile.h: TiFreeIf/TiFree1() API

This commit is contained in:
Darryl L. Miles 2025-06-27 14:47:48 +01:00 committed by R. Timothy Edwards
parent 1eb2231bbf
commit 15e5b36f52
2 changed files with 43 additions and 0 deletions

View File

@ -849,6 +849,28 @@ TiFree(
#endif /* !HAVE_SYS_MMAN_H */
#ifdef __GNUC_STDC_INLINE__
/* Use of 'extern inline' force an emit of inline code at a symbol */
extern inline void TiFreeIf(Tile *tile);
extern inline void TiFree1(Tile **delay1, Tile *tile);
#else
/* To support older compilers (that don't auto emit based on -O level) */
void
TiFreeIf(Tile *tile)
{
if (tile != NULL)
TiFree(tile);
}
void
TiFree1(Tile **delay1, Tile *tile)
{
TiFreeIf(*delay1);
*delay1 = tile;
}
#endif
/* ==================================================================== */
/* */
/* DEBUGGING PROCEDURES */

View File

@ -249,6 +249,27 @@ extern Tile *TiSrPoint(Tile *hint, Plane *plane, const Point *point);
extern Tile *TiAlloc(void);
extern void TiFree(Tile *tile);
#ifdef __GNUC_STDC_INLINE__
/* Provide compiler visibility of STDC 'inline' semantics */
inline void
TiFreeIf(Tile *tile)
{
if (tile != NULL)
TiFree(tile);
}
inline void
TiFree1(Tile **delay1, Tile *tile)
{
TiFreeIf(*delay1);
*delay1 = tile;
}
#else
/* To support older compilers (that don't auto emit based on -O level) */
extern void TiFreeIf(Tile *tile);
extern void TiFree1(Tile **delay1, Tile *tile);
#endif
#define EnclosePoint(tile,point) ((LEFT(tile) <= (point)->p_x ) && \
((point)->p_x < RIGHT(tile)) && \
(BOTTOM(tile) <= (point)->p_y ) && \