tile.h: TiFreeIf/TiFree1() API
This commit is contained in:
parent
1eb2231bbf
commit
15e5b36f52
22
tiles/tile.c
22
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 */
|
||||
|
|
|
|||
21
tiles/tile.h
21
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 ) && \
|
||||
|
|
|
|||
Loading…
Reference in New Issue