diff options
author | 2016-11-04 16:56:55 +0200 | |
---|---|---|
committer | 2016-11-04 16:56:55 +0200 | |
commit | 5abe95c474262dfc0d43cd8fdd5248c9b48a8ecf (patch) | |
tree | 2d3aa11ff5e0b59024f710e34e26058e74a8fcf2 /include | |
parent | ce0841ecfaca463c93dd5551bc5f45cd9365a938 (diff) | |
download | librin-5abe95c474262dfc0d43cd8fdd5248c9b48a8ecf.tar.gz librin-5abe95c474262dfc0d43cd8fdd5248c9b48a8ecf.tar.bz2 librin-5abe95c474262dfc0d43cd8fdd5248c9b48a8ecf.zip |
definitions: add a run-once construct macro.
Diffstat (limited to 'include')
-rw-r--r-- | include/rin/definitions.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/rin/definitions.h b/include/rin/definitions.h index bc417b5..8364f42 100644 --- a/include/rin/definitions.h +++ b/include/rin/definitions.h @@ -29,4 +29,13 @@ # define WEAK_SYM #endif +#define rin_once(func) \ +do { \ + static unsigned int __rin_firstrun = 1; \ + if (__rin_firstrun) { \ + --__rin_firstrun; \ + func; \ + } \ +} while (0) + #endif /* LIBRIN_DEFINITIONS_INCLUDED */ |