From ecaaf8c15f98551f809d5219f87af7fdb451c029 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Fri, 2 Apr 2010 02:01:25 +0200 Subject: gallium/util: add one-time initialization helper --- src/gallium/auxiliary/util/u_inline_init.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/gallium/auxiliary/util/u_inline_init.h (limited to 'src/gallium/auxiliary') diff --git a/src/gallium/auxiliary/util/u_inline_init.h b/src/gallium/auxiliary/util/u_inline_init.h new file mode 100644 index 00000000000..7f2c591a3d4 --- /dev/null +++ b/src/gallium/auxiliary/util/u_inline_init.h @@ -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_ */ -- cgit v1.2.3