Blame SOURCES/0358-posix_wrap-tweaks-in-preparation-for-libtasn1.patch

80913e
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
80913e
From: Daniel Axtens <dja@axtens.net>
80913e
Date: Sat, 2 May 2020 00:27:57 +1000
80913e
Subject: [PATCH] posix_wrap: tweaks in preparation for libtasn1
80913e
80913e
 - Define SIZEOF_UNSIGNED_LONG_INT, it's the same as
80913e
   SIZEOF_UNSIGNED_LONG.
80913e
80913e
 - Define WORD_BIT, the size in bits of an int. This is a defined
80913e
   in the Single Unix Specification and in gnulib's limits.h. gnulib
80913e
   assumes it's 32 bits on all our platforms, including 64 bit
80913e
   platforms, so we also use that value.
80913e
80913e
 - Provide strto[u]l[l] preprocessor macros that resolve to
80913e
   grub_strto[u]l[l]. To avoid gcrypt redefining strtoul, we
80913e
   also define HAVE_STRTOUL here.
80913e
80913e
Signed-off-by: Daniel Axtens <dja@axtens.net>
80913e
---
80913e
 grub-core/lib/posix_wrap/limits.h    | 1 +
80913e
 grub-core/lib/posix_wrap/stdlib.h    | 8 ++++++++
80913e
 grub-core/lib/posix_wrap/sys/types.h | 1 +
80913e
 3 files changed, 10 insertions(+)
80913e
80913e
diff --git a/grub-core/lib/posix_wrap/limits.h b/grub-core/lib/posix_wrap/limits.h
b32e65
index 955295403..474a923b0 100644
80913e
--- a/grub-core/lib/posix_wrap/limits.h
80913e
+++ b/grub-core/lib/posix_wrap/limits.h
80913e
@@ -31,5 +31,6 @@
80913e
 #define INT_MAX GRUB_INT_MAX
80913e
 
80913e
 #define CHAR_BIT 8
80913e
+#define WORD_BIT 32
80913e
 
80913e
 #endif
80913e
diff --git a/grub-core/lib/posix_wrap/stdlib.h b/grub-core/lib/posix_wrap/stdlib.h
b32e65
index 7a8d385e9..4634db09f 100644
80913e
--- a/grub-core/lib/posix_wrap/stdlib.h
80913e
+++ b/grub-core/lib/posix_wrap/stdlib.h
80913e
@@ -58,4 +58,12 @@ abs (int c)
80913e
   return (c >= 0) ? c : -c;
80913e
 }
80913e
 
80913e
+#define strtol grub_strtol
80913e
+
80913e
+/* for libgcrypt */
80913e
+#define HAVE_STRTOUL
80913e
+#define strtoul grub_strtoul
80913e
+
80913e
+#define strtoull grub_strtoull
80913e
+
80913e
 #endif
80913e
diff --git a/grub-core/lib/posix_wrap/sys/types.h b/grub-core/lib/posix_wrap/sys/types.h
b32e65
index 854eb0122..f63412c8d 100644
80913e
--- a/grub-core/lib/posix_wrap/sys/types.h
80913e
+++ b/grub-core/lib/posix_wrap/sys/types.h
80913e
@@ -51,6 +51,7 @@ typedef grub_uint8_t byte;
80913e
 typedef grub_addr_t uintptr_t;
80913e
 
80913e
 #define SIZEOF_UNSIGNED_LONG GRUB_CPU_SIZEOF_LONG
80913e
+#define SIZEOF_UNSIGNED_LONG_INT GRUB_CPU_SIZEOF_LONG
80913e
 #define SIZEOF_UNSIGNED_INT 4
80913e
 #define SIZEOF_UNSIGNED_LONG_LONG 8
80913e
 #define SIZEOF_UNSIGNED_SHORT 2