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

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