nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

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

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