Mesa (master): gallium/util: add one-time initialization helper

Luca Barbieri lb at kemper.freedesktop.org
Fri Apr 2 00:10:59 UTC 2010


Module: Mesa
Branch: master
Commit: ecaaf8c15f98551f809d5219f87af7fdb451c029
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=ecaaf8c15f98551f809d5219f87af7fdb451c029

Author: Luca Barbieri <luca at luca-barbieri.com>
Date:   Fri Apr  2 02:01:25 2010 +0200

gallium/util: add one-time initialization helper

---

 src/gallium/auxiliary/util/u_inline_init.h |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

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 0000000..7f2c591
--- /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_ */




More information about the mesa-commit mailing list