void qsort_b(void *base, size_t nel, size_t width, DECLARE_BLOCK(int, compar, const void *, const void *)) { qsort_r(base, nel, width, compar, (int (*)(void *, const void *, const void *)) GET_BLOCK_FUNCTION(compar)); }
static int fts_compar_b(void *thunk, const void *a, const void *b) { FTS *sp = (FTS *)thunk; int (*funcp)(const void *, const void *); funcp = (int (*)(const void *, const void *)) GET_BLOCK_FUNCTION(sp->fts_compar_b); return (*funcp)(a, b); }
/** * Register a block to be performed at exit. */ int atexit_b(atexit_block func) { struct atexit_fn fn; int error; if (_Block_copy == 0) { errno = ENOSYS; return -1; } func = _Block_copy(func); // Blocks are not C++ destructors, but they have the same signature (a // single void* parameter), so we can pretend that they are. fn.fn_type = ATEXIT_FN_CXA; fn.fn_ptr.cxa_func = (void(*)(void*))GET_BLOCK_FUNCTION(func); fn.fn_arg = func; fn.fn_dso = NULL; error = atexit_register(&fn); return (error); }