From: Luca Barbieri Date: Fri, 2 Apr 2010 00:01:25 +0000 (+0200) Subject: gallium/util: add one-time initialization helper X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ecaaf8c15f98551f809d5219f87af7fdb451c029;p=mesa.git gallium/util: add one-time initialization helper --- 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_ */