logo

oasis

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

0002-Avoid-a-few-unnecessary-statement-expressions.patch (1661B)


  1. From edb05302e2c747253afd4698bc445e36c8726306 Mon Sep 17 00:00:00 2001
  2. From: Michael Forney <mforney@mforney.org>
  3. Date: Tue, 18 Jun 2019 02:29:07 -0700
  4. Subject: [PATCH] Avoid a few unnecessary statement expressions
  5. ---
  6. include/c.h | 13 ++++++-------
  7. 1 file changed, 6 insertions(+), 7 deletions(-)
  8. diff --git a/include/c.h b/include/c.h
  9. index b891ad480..b420b5187 100644
  10. --- a/include/c.h
  11. +++ b/include/c.h
  12. @@ -176,9 +176,8 @@
  13. * @member: the name of the member within the struct.
  14. */
  15. #ifndef container_of
  16. -#define container_of(ptr, type, member) __extension__ ({ \
  17. - const __typeof__( ((type *)0)->member ) *__mptr = (ptr); \
  18. - (type *)( (char *)__mptr - offsetof(type,member) );})
  19. +#define container_of(ptr, type, member) \
  20. + ((type *)( (char *)ptr - offsetof(type,member) ))
  21. #endif
  22. #ifndef HAVE_PROGRAM_INVOCATION_SHORT_NAME
  23. @@ -256,11 +255,11 @@ errmsg(char doexit, int excode, char adderr, const char *fmt, ...)
  24. /* Don't use inline function to avoid '#include "nls.h"' in c.h
  25. */
  26. -#define errtryhelp(eval) __extension__ ({ \
  27. +#define errtryhelp(eval) do { \
  28. fprintf(stderr, _("Try '%s --help' for more information.\n"), \
  29. program_invocation_short_name); \
  30. exit(eval); \
  31. -})
  32. +} while (0)
  33. /* After failed execvp() */
  34. #define EX_EXEC_FAILED 126 /* Program located, but not usable. */
  35. @@ -387,10 +386,10 @@ static inline int xusleep(useconds_t usec)
  36. #define UTIL_LINUX_VERSION _("%s from %s\n"), program_invocation_short_name, PACKAGE_STRING
  37. -#define print_version(eval) __extension__ ({ \
  38. +#define print_version(eval) do { \
  39. printf(UTIL_LINUX_VERSION); \
  40. exit(eval); \
  41. -})
  42. +} while (0)
  43. /*
  44. * seek stuff
  45. --
  46. 2.31.1