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

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