Why did I need to cast cb to a particular type? I don't know. Fixes commit 9c8fccdf382c2c8483b557acc6b5d41a4e193990. --- lib/internal.h | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/lib/internal.h b/lib/internal.h index a18d581..1344d98 100644 --- a/lib/internal.h +++ b/lib/internal.h @@ -282,17 +282,11 @@ struct command { #define CALL_CALLBACK(cb, ...) \ (cb).callback ((cb).user_data, ##__VA_ARGS__) -/* Free a callback. - * - * Note this works for any type of callback because the basic layout - * of the struct is the same for all of them. Therefore casting cb to - * nbd_completion_callback does not change the effective code. - */ +/* Free a callback. */ #define FREE_CALLBACK(cb) \ do { \ - nbd_completion_callback *_cb = (nbd_completion_callback *)&(cb); \ - if (CALLBACK_IS_NOT_NULL (cb) && _cb->free != NULL) \ - _cb->free (_cb->user_data); \ + if (CALLBACK_IS_NOT_NULL (cb) && (cb).free != NULL) \ + (cb).free ((cb).user_data); \ SET_CALLBACK_TO_NULL (cb); \ } while (0) -- 2.22.0