[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 01/11] Fix base64 module to work with grub codebase

From: Robbie Harwood
Subject: [PATCH 01/11] Fix base64 module to work with grub codebase
Date: Mon, 25 Oct 2021 17:55:34 -0400

From: Patrick Steinhardt <ps@pks.im>

The gnulib module makes use of booleans via the <stdbool.h> header. As
GRUB does not provide any POSIX wrapper header for this, but instead
implements support for bool in <sys/types.h>, we need to patch
base64.h to not use <stdbool.h> anymore. We unfortunately cannot include
<sys/types.h> instead, as it would then use gnulib's internal header
while compiling the gnulib object but our own <sys/types.h> when
including it in a GRUB module. Because of this, the patch replaces the
include with a direct typedef.

A second fix is required to make available _GL_ATTRIBUTE_CONST, which
is provided by the configure script. As base64.h does not include
<config.h>, it is thus not available and results in a compile error.
This is fixed by adding an include of <config-util.h>.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
[rharwood@redhat.com: squished commit messages, wrote subject]
Signed-off-by: Robbie Harwood <rharwood@redhat.com>
 lib/base64.h | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/lib/base64.h b/lib/base64.h
index e58ccfb1f..fd108fb35 100644
--- a/lib/base64.h
+++ b/lib/base64.h
@@ -21,8 +21,14 @@
 /* Get idx_t.  */
 # include <idx.h>
-/* Get bool. */
-# include <stdbool.h>
+typedef enum { false = 0, true = 1 } bool;
+# define _GL_ATTRIBUTE_CONST /* empty */
 # ifdef __cplusplus
 extern "C" {

reply via email to

[Prev in Thread] Current Thread [Next in Thread]