diff --git a/tiles/tile.c b/tiles/tile.c index d429bc1a..0ba7afb2 100644 --- a/tiles/tile.c +++ b/tiles/tile.c @@ -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 */ diff --git a/tiles/tile.h b/tiles/tile.h index 49d0d40c..4383d389 100644 --- a/tiles/tile.h +++ b/tiles/tile.h @@ -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 ) && \