diff options
author | Luca Barbieri <luca@luca-barbieri.com> | 2010-04-02 02:01:25 +0200 |
---|---|---|
committer | Luca Barbieri <luca@luca-barbieri.com> | 2010-04-02 02:01:25 +0200 |
commit | ecaaf8c15f98551f809d5219f87af7fdb451c029 (patch) | |
tree | 10e2500166be112350223bde2221a0504e06188e /src | |
parent | 3040462c10c19ba8f4a2ab64feee41a18c86a578 (diff) |
gallium/util: add one-time initialization helper
Diffstat (limited to 'src')
-rw-r--r-- | 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 0000000000..7f2c591a3d --- /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_ */ |