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 (1772B)


  1. From 7f1d554cb07e8ada1842983e8ff8fa4dfe2ecf55 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 dcb2d683c..3ba42306c 100644
  10. --- a/include/c.h
  11. +++ b/include/c.h
  12. @@ -210,9 +210,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. #define read_unaligned_member(p, m) __extension__ ({ \
  23. @@ -310,11 +309,11 @@ void __err_oom(const char *file, unsigned int line)
  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. @@ -481,10 +480,10 @@ static inline void __attribute__((__noreturn__)) ul_sig_err(int excode, const ch
  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. static inline void print_features(const char *const*features, const char *prefix)
  44. {
  45. --
  46. 2.49.0