diff options
author | Chris Robinson <[email protected]> | 2015-05-18 16:39:44 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2015-05-18 16:39:44 -0700 |
commit | 9f49ac0fda04cc4bdc9e47a0d3c026722283c3a4 (patch) | |
tree | a5654bd758c2e7de5b58c50a8147541505f1b7bb /OpenAL32/Include | |
parent | 9479ea656bd4c7d3059b63405237829296776c10 (diff) |
Add a macro to simplify allocating and constructing an object
Diffstat (limited to 'OpenAL32/Include')
-rw-r--r-- | OpenAL32/Include/alMain.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h index e92e94fb..8d766939 100644 --- a/OpenAL32/Include/alMain.h +++ b/OpenAL32/Include/alMain.h @@ -413,6 +413,18 @@ static void T##_Delete(void *ptr) { al_free(ptr); } } while(0) +#define EXTRACT_NEW_ARGS(...) __VA_ARGS__); \ + } \ +} while(0) + +#define NEW_OBJ(_ptr, T) do { \ + _ptr = T##_New(sizeof(*_ptr)); \ + if(_ptr) \ + { \ + memset(_ptr, 0, sizeof(*_ptr)); \ + T##_Construct(_ptr, EXTRACT_NEW_ARGS + + #ifdef __cplusplus extern "C" { #endif |