logo

oasis

Own branch of Oasis Linux (upstream: <https://git.sr.ht/~mcf/oasis/>) git clone https://anongit.hacktivis.me/git/oasis.git

0011-Avoid-statement-expression-in-container_of-macro.patch (811B)


  1. From 3f7a20f30c23aead6460e18fda27ba439b369045 Mon Sep 17 00:00:00 2001
  2. From: Michael Forney <mforney@mforney.org>
  3. Date: Tue, 2 Jul 2019 19:53:34 -0700
  4. Subject: [PATCH] Avoid statement expression in container_of macro
  5. ---
  6. sshfs.c | 5 ++---
  7. 1 file changed, 2 insertions(+), 3 deletions(-)
  8. diff --git a/sshfs.c b/sshfs.c
  9. index 133b248..8f974e2 100644
  10. --- a/sshfs.c
  11. +++ b/sshfs.c
  12. @@ -522,9 +522,8 @@ static const char *type_name(uint8_t type)
  13. }
  14. }
  15. -#define container_of(ptr, type, member) ({ \
  16. - const typeof( ((type *)0)->member ) *__mptr = (ptr); \
  17. - (type *)( (char *)__mptr - offsetof(type,member) );})
  18. +#define container_of(ptr, type, member) ( \
  19. + (type *)( (char *)(ptr) - offsetof(type,member) ))
  20. #define list_entry(ptr, type, member) \
  21. container_of(ptr, type, member)
  22. --
  23. 2.24.0