|
|
|
|
@ -1031,19 +1031,13 @@ char *ast_utils_which(const char *binary, char *fullpath, size_t fullpath_size);
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#if defined(__clang__)
|
|
|
|
|
|
|
|
|
|
#if defined(__has_feature) && __has_feature(blocks)
|
|
|
|
|
typedef void (^_raii_cleanup_block_t)(void);
|
|
|
|
|
static inline void _raii_cleanup_block(_raii_cleanup_block_t *b) { (*b)(); }
|
|
|
|
|
|
|
|
|
|
#define RAII_VAR(vartype, varname, initval, dtor) \
|
|
|
|
|
_raii_cleanup_block_t _raii_cleanup_ ## varname __attribute__((cleanup(_raii_cleanup_block),unused)) = NULL; \
|
|
|
|
|
vartype varname = initval; \
|
|
|
|
|
_raii_cleanup_ ## varname = ^{ dtor(varname); }
|
|
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
#error "CLANG must support the 'blocks' feature to compile Asterisk."
|
|
|
|
|
#endif /* #if defined(__has_feature) && __has_feature(blocks) */
|
|
|
|
|
__block vartype varname = initval; \
|
|
|
|
|
_raii_cleanup_ ## varname = ^{ {(void)dtor(varname);} }
|
|
|
|
|
|
|
|
|
|
#elif defined(__GNUC__)
|
|
|
|
|
|
|
|
|
|
|