logo

oasis

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

0003-Remove-need-for-size_t-size-check.patch (2446B)


  1. From a7120321640d03c0ec7444719366bec99add6542 Mon Sep 17 00:00:00 2001
  2. From: Michael Forney <mforney@mforney.org>
  3. Date: Wed, 1 Dec 2021 16:05:33 -0800
  4. Subject: [PATCH] Remove need for size_t size check
  5. ---
  6. configure | 33 ---------------------------------
  7. configure.ac | 1 -
  8. util/regional.c | 8 +-------
  9. 3 files changed, 1 insertion(+), 41 deletions(-)
  10. diff --git a/configure b/configure
  11. index 9c33d22f..8b012048 100755
  12. --- a/configure
  13. +++ b/configure
  14. @@ -15163,39 +15163,6 @@ cat >>confdefs.h <<_ACEOF
  15. _ACEOF
  16. -# The cast to long int works around a bug in the HP C Compiler
  17. -# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
  18. -# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
  19. -# This bug is HP SR number 8606223364.
  20. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of size_t" >&5
  21. -$as_echo_n "checking size of size_t... " >&6; }
  22. -if ${ac_cv_sizeof_size_t+:} false; then :
  23. - $as_echo_n "(cached) " >&6
  24. -else
  25. - if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (size_t))" "ac_cv_sizeof_size_t" "$ac_includes_default"; then :
  26. -
  27. -else
  28. - if test "$ac_cv_type_size_t" = yes; then
  29. - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
  30. -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
  31. -as_fn_error 77 "cannot compute sizeof (size_t)
  32. -See \`config.log' for more details" "$LINENO" 5; }
  33. - else
  34. - ac_cv_sizeof_size_t=0
  35. - fi
  36. -fi
  37. -
  38. -fi
  39. -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_size_t" >&5
  40. -$as_echo "$ac_cv_sizeof_size_t" >&6; }
  41. -
  42. -
  43. -
  44. -cat >>confdefs.h <<_ACEOF
  45. -#define SIZEOF_SIZE_T $ac_cv_sizeof_size_t
  46. -_ACEOF
  47. -
  48. -
  49. # add option to disable the evil rpath
  50. diff --git a/configure.ac b/configure.ac
  51. index 9e15aee4..750e9bfd 100644
  52. --- a/configure.ac
  53. +++ b/configure.ac
  54. @@ -448,7 +448,6 @@ AC_INCLUDES_DEFAULT
  55. # endif
  56. #endif
  57. ])
  58. -AC_CHECK_SIZEOF(size_t)
  59. # add option to disable the evil rpath
  60. ACX_ARG_RPATH
  61. diff --git a/util/regional.c b/util/regional.c
  62. index 93e911c5..1c6629c3 100644
  63. --- a/util/regional.c
  64. +++ b/util/regional.c
  65. @@ -146,13 +146,7 @@ regional_alloc(struct regional *r, size_t size)
  66. {
  67. size_t a;
  68. void *s;
  69. - if(
  70. -#if SIZEOF_SIZE_T == 8
  71. - (unsigned long long)size >= 0xffffffffffffff00ULL
  72. -#else
  73. - (unsigned)size >= (unsigned)0xffffff00UL
  74. -#endif
  75. - )
  76. + if(size >= (size_t)-0x100)
  77. return NULL; /* protect against integer overflow in
  78. malloc and ALIGN_UP */
  79. a = ALIGN_UP(size, ALIGNMENT);
  80. --
  81. 2.34.1