gallium/util: add one-time initialization helper

This commit is contained in:
Luca Barbieri
2010-04-02 02:01:25 +02:00
parent 3040462c10
commit ecaaf8c15f
@@ -0,0 +1,15 @@
#ifndef U_INLINE_INIT_H_
#define U_INLINE_INIT_H_
#define UTIL_INLINE_INIT(m) \
extern boolean m##_inited; \
extern void m##_do_init(void); \
static inline void m##_init(void) \
{ \
if(!m##_inited) { \
m##_do_init(); \
m##_inited = TRUE; \
} \
}
#endif /* U_INLINE_INIT_H_ */