dcavalca / rpms / grub2

Forked from rpms/grub2 3 years ago
Clone

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

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