Skip to contentSkip to conversation

arm64/xen: Use bool instead of int

PATCH In review Frediano Ziglio via Grub-devel 3 participants 5 messages Jul 4, 2025 – Jul 10, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm64/xen: Use bool instead of int

More readable, could consume less space.

---
 grub-core/loader/arm64/xen_boot.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
grub-core/loader/arm64/xen_boot.c +7 -7
index 731f1913a..8db1d9db0 100644
@@ -67,7 +67,7 @@ struct xen_boot_binary
 {
   struct xen_boot_binary *next;
   struct xen_boot_binary **prev;
-  int is_hypervisor;
+  bool is_hypervisor;
 
   grub_addr_t start;
   grub_size_t size;
@@ -79,7 +79,7 @@ struct xen_boot_binary
 
 static grub_dl_t my_mod;
 
-static int loaded;
+static bool loaded;
 
 static struct xen_boot_binary *xen_hypervisor;
 static struct xen_boot_binary *module_head;
@@ -306,7 +306,7 @@ all_binaries_unload (void)
 static grub_err_t
 xen_unload (void)
 {
-  loaded = 0;
+  loaded = false;
   all_binaries_unload ();
   grub_fdt_unload ();
   grub_dl_unref (my_mod);
@@ -410,7 +410,7 @@ grub_cmd_xen_module (grub_command_t cmd __attribute__((unused)),
   if (!module)
     return grub_errno;
 
-  module->is_hypervisor = 0;
+  module->is_hypervisor = false;
   module->align = 4096;
 
   grub_dprintf ("xen_loader", "Init module and node info\n");
@@ -466,7 +466,7 @@ grub_cmd_xen_hypervisor (grub_command_t cmd __attribute__ ((unused)),
   if (!xen_hypervisor)
     return grub_errno;
 
-  xen_hypervisor->is_hypervisor = 1;
+  xen_hypervisor->is_hypervisor = true;
   xen_hypervisor->align
     = (grub_size_t) lh.pe_image_header.optional_header.section_alignment;
 
@@ -474,7 +474,7 @@ grub_cmd_xen_hypervisor (grub_command_t cmd __attribute__ ((unused)),
   if (grub_errno == GRUB_ERR_NONE)
     {
       grub_loader_set (xen_boot, xen_unload, 0);
-      loaded = 1;
+      loaded = true;
     }
 
 fail:
@@ -482,7 +482,7 @@ fail:
     grub_file_close (file);
   if (grub_errno != GRUB_ERR_NONE)
     {
-      loaded = 0;
+      loaded = false;
       all_binaries_unload ();
       grub_dl_unref (my_mod);
     }
Signature · 7 lines
2.43.0


_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
#1 lore raw
Quoted 16 lines · Frediano Ziglio via Grub-devel

More readable, could consume less space.

---
grub-core/loader/arm64/xen_boot.c | 14 +++++++-------

1 file changed, 7 insertions(+), 7 deletions(-)
grub-core/loader/arm64/xen_boot.c +0 -0
index 731f1913a..8db1d9db0 100644

grub-core/loader/arm64/xen_boot.c struct xen_boot_binary · line 70

Quoted 5 lines
grub-core/loader/arm64/xen_boot.c +1 -1
@@ -67,7 +67,7 @@ struct xen_boot_binary
 {
  struct xen_boot_binary *next;
  struct xen_boot_binary **prev;
-  int is_hypervisor;
+  bool is_hypervisor;

Something is off with indention here

grub-core/loader/arm64/xen_boot.c struct xen_boot_binary · line 82

Quoted 9 lines
grub-core/loader/arm64/xen_boot.c +1 -1
  grub_addr_t start;
  grub_size_t size;
@@ -79,7 +79,7 @@ struct xen_boot_binary
 
 static grub_dl_t my_mod;
 
-static int loaded;
+static bool loaded;

Something is off with indention here

grub-core/loader/arm64/xen_boot.c

Quoted 9 lines
grub-core/loader/arm64/xen_boot.c +0 -0
 static struct xen_boot_binary *xen_hypervisor;
 static struct xen_boot_binary *module_head;
@@ -306,7 +306,7 @@ all_binaries_unload (void)

static grub_err_t
xen_unload (void)
{

grub-core/loader/arm64/xen_boot.c +1 -1
-  loaded = 0;
+  loaded = false;

Something is off with indention here

Quoted 13 lines
  all_binaries_unload ();
  grub_fdt_unload ();
  grub_dl_unref (my_mod);
grub-core/loader/arm64/xen_boot.c +1 -1
@@ -410,7 +410,7 @@ grub_cmd_xen_module (grub_command_t cmd __attribute__((unused)),
  if (!module)
    return grub_errno;
 
-  module->is_hypervisor = 0;
+  module->is_hypervisor = false;
  module->align = 4096;
 
  grub_dprintf ("xen_loader", "Init module and node info\n");

grub-core/loader/arm64/xen_boot.c grub_cmd_xen_hypervisor (grub_command_t cmd __attribute__ ((unused)), · line 469

Quoted 5 lines
grub-core/loader/arm64/xen_boot.c +1 -1
@@ -466,7 +466,7 @@ grub_cmd_xen_hypervisor (grub_command_t cmd __attribute__ ((unused)),
  if (!xen_hypervisor)
    return grub_errno;
 
-  xen_hypervisor->is_hypervisor = 1;
+  xen_hypervisor->is_hypervisor = true;

Same here.

grub-core/loader/arm64/xen_boot.c grub_cmd_xen_hypervisor (grub_command_t cmd __attribute__ ((unused)), · line 477

Quoted 9 lines
grub-core/loader/arm64/xen_boot.c +1 -1
  xen_hypervisor->align
    = (grub_size_t) lh.pe_image_header.optional_header.section_alignment;
 
@@ -474,7 +474,7 @@ grub_cmd_xen_hypervisor (grub_command_t cmd __attribute__ ((unused)),
  if (grub_errno == GRUB_ERR_NONE)
    {
      grub_loader_set (xen_boot, xen_unload, 0);
-      loaded = 1;
+      loaded = true;

Same here.

grub-core/loader/arm64/xen_boot.c fail: · line 485

Quoted 9 lines
grub-core/loader/arm64/xen_boot.c +0 -0
    }
 

fail:

grub-core/loader/arm64/xen_boot.c +1 -1
@@ -482,7 +482,7 @@ fail:
    grub_file_close (file);
  if (grub_errno != GRUB_ERR_NONE)
    {
-      loaded = 0;
+      loaded = false;

same here

Thanks,
Sudhakar

Quoted 11 lines
grub-core/loader/arm64/xen_boot.c +0 -0
      all_binaries_unload ();
      grub_dl_unref (my_mod);
    }
Signature · 7 lines
2.43.0


_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

#2 lore raw
Quoted 88 lines · Sudhakar Kuppusamy
Quoted 17 lines · Frediano Ziglio via Grub-devel

More readable, could consume less space.

---
grub-core/loader/arm64/xen_boot.c | 14 +++++++-------

1 file changed, 7 insertions(+), 7 deletions(-)
grub-core/loader/arm64/xen_boot.c +0 -0
index 731f1913a..8db1d9db0 100644

grub-core/loader/arm64/xen_boot.c struct xen_boot_binary · line 70

Quoted 5 lines
grub-core/loader/arm64/xen_boot.c +1 -1
@@ -67,7 +67,7 @@ struct xen_boot_binary
 {
  struct xen_boot_binary *next;
  struct xen_boot_binary **prev;
-  int is_hypervisor;
+  bool is_hypervisor;

Something is off with indention here

grub-core/loader/arm64/xen_boot.c struct xen_boot_binary · line 82

Quoted 9 lines
grub-core/loader/arm64/xen_boot.c +1 -1
  grub_addr_t start;
  grub_size_t size;
@@ -79,7 +79,7 @@ struct xen_boot_binary
 
 static grub_dl_t my_mod;
 
-static int loaded;
+static bool loaded;

Something is off with indention here

grub-core/loader/arm64/xen_boot.c

Quoted 9 lines
grub-core/loader/arm64/xen_boot.c +0 -0
 static struct xen_boot_binary *xen_hypervisor;
 static struct xen_boot_binary *module_head;
@@ -306,7 +306,7 @@ all_binaries_unload (void)

static grub_err_t
xen_unload (void)
{

grub-core/loader/arm64/xen_boot.c +1 -1
-  loaded = 0;
+  loaded = false;

Something is off with indention here

Quoted 13 lines
  all_binaries_unload ();
  grub_fdt_unload ();
  grub_dl_unref (my_mod);
grub-core/loader/arm64/xen_boot.c +1 -1
@@ -410,7 +410,7 @@ grub_cmd_xen_module (grub_command_t cmd __attribute__((unused)),
  if (!module)
    return grub_errno;
 
-  module->is_hypervisor = 0;
+  module->is_hypervisor = false;
  module->align = 4096;
 
  grub_dprintf ("xen_loader", "Init module and node info\n");

grub-core/loader/arm64/xen_boot.c grub_cmd_xen_hypervisor (grub_command_t cmd __attribute__ ((unused)), · line 469

Quoted 5 lines
grub-core/loader/arm64/xen_boot.c +1 -1
@@ -466,7 +466,7 @@ grub_cmd_xen_hypervisor (grub_command_t cmd __attribute__ ((unused)),
  if (!xen_hypervisor)
    return grub_errno;
 
-  xen_hypervisor->is_hypervisor = 1;
+  xen_hypervisor->is_hypervisor = true;

Same here.

grub-core/loader/arm64/xen_boot.c grub_cmd_xen_hypervisor (grub_command_t cmd __attribute__ ((unused)), · line 477

Quoted 9 lines
grub-core/loader/arm64/xen_boot.c +1 -1
  xen_hypervisor->align
    = (grub_size_t) lh.pe_image_header.optional_header.section_alignment;
 
@@ -474,7 +474,7 @@ grub_cmd_xen_hypervisor (grub_command_t cmd __attribute__ ((unused)),
  if (grub_errno == GRUB_ERR_NONE)
    {
      grub_loader_set (xen_boot, xen_unload, 0);
-      loaded = 1;
+      loaded = true;

Same here.

grub-core/loader/arm64/xen_boot.c fail: · line 485

Quoted 9 lines
grub-core/loader/arm64/xen_boot.c +0 -0
    }
 

fail:

grub-core/loader/arm64/xen_boot.c +1 -1
@@ -482,7 +482,7 @@ fail:
    grub_file_close (file);
  if (grub_errno != GRUB_ERR_NONE)
    {
-      loaded = 0;
+      loaded = false;

same here

Quoted 5 lines

Thanks,
Sudhakar

Quoted 3 lines
grub-core/loader/arm64/xen_boot.c +0 -0
      all_binaries_unload ();
      grub_dl_unref (my_mod);
    }

None on my side. Are you sure it's not a question of your fonts?

Frediano

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

Reviewed-by
#3 lore raw
Quoted 94 lines · Frediano Ziglio
Quoted 88 lines · Sudhakar Kuppusamy
Quoted 17 lines · Frediano Ziglio via Grub-devel

More readable, could consume less space.

---
grub-core/loader/arm64/xen_boot.c | 14 +++++++-------

1 file changed, 7 insertions(+), 7 deletions(-)
grub-core/loader/arm64/xen_boot.c +0 -0
index 731f1913a..8db1d9db0 100644

grub-core/loader/arm64/xen_boot.c struct xen_boot_binary · line 70

Quoted 5 lines
grub-core/loader/arm64/xen_boot.c +1 -1
@@ -67,7 +67,7 @@ struct xen_boot_binary
 {
 struct xen_boot_binary *next;
 struct xen_boot_binary **prev;
-  int is_hypervisor;
+  bool is_hypervisor;

Something is off with indention here

grub-core/loader/arm64/xen_boot.c struct xen_boot_binary · line 82

Quoted 9 lines
grub-core/loader/arm64/xen_boot.c +1 -1
 grub_addr_t start;
 grub_size_t size;
@@ -79,7 +79,7 @@ struct xen_boot_binary
 
 static grub_dl_t my_mod;
 
-static int loaded;
+static bool loaded;

Something is off with indention here

grub-core/loader/arm64/xen_boot.c

Quoted 9 lines
grub-core/loader/arm64/xen_boot.c +0 -0
 static struct xen_boot_binary *xen_hypervisor;
 static struct xen_boot_binary *module_head;
@@ -306,7 +306,7 @@ all_binaries_unload (void)

static grub_err_t
xen_unload (void)
{

grub-core/loader/arm64/xen_boot.c +1 -1
-  loaded = 0;
+  loaded = false;

Something is off with indention here

Quoted 13 lines

all_binaries_unload ();
grub_fdt_unload ();
grub_dl_unref (my_mod);

grub-core/loader/arm64/xen_boot.c +1 -1
@@ -410,7 +410,7 @@ grub_cmd_xen_module (grub_command_t cmd __attribute__((unused)),
 if (!module)
   return grub_errno;
 
-  module->is_hypervisor = 0;
+  module->is_hypervisor = false;
 module->align = 4096;
 
 grub_dprintf ("xen_loader", "Init module and node info\n");

grub-core/loader/arm64/xen_boot.c grub_cmd_xen_hypervisor (grub_command_t cmd __attribute__ ((unused)), · line 469

Quoted 5 lines
grub-core/loader/arm64/xen_boot.c +1 -1
@@ -466,7 +466,7 @@ grub_cmd_xen_hypervisor (grub_command_t cmd __attribute__ ((unused)),
 if (!xen_hypervisor)
   return grub_errno;
 
-  xen_hypervisor->is_hypervisor = 1;
+  xen_hypervisor->is_hypervisor = true;

Same here.

grub-core/loader/arm64/xen_boot.c grub_cmd_xen_hypervisor (grub_command_t cmd __attribute__ ((unused)), · line 477

Quoted 9 lines
grub-core/loader/arm64/xen_boot.c +1 -1
 xen_hypervisor->align
   = (grub_size_t) lh.pe_image_header.optional_header.section_alignment;
 
@@ -474,7 +474,7 @@ grub_cmd_xen_hypervisor (grub_command_t cmd __attribute__ ((unused)),
 if (grub_errno == GRUB_ERR_NONE)
   {
     grub_loader_set (xen_boot, xen_unload, 0);
-      loaded = 1;
+      loaded = true;

Same here.

grub-core/loader/arm64/xen_boot.c fail: · line 485

Quoted 9 lines
grub-core/loader/arm64/xen_boot.c +0 -0
   }
 

fail:

grub-core/loader/arm64/xen_boot.c +1 -1
@@ -482,7 +482,7 @@ fail:
   grub_file_close (file);
 if (grub_errno != GRUB_ERR_NONE)
   {
-      loaded = 0;
+      loaded = false;

same here

Quoted 7 lines
Quoted 5 lines

Thanks,
Sudhakar

Quoted 3 lines
grub-core/loader/arm64/xen_boot.c +0 -0
     all_binaries_unload ();
     grub_dl_unref (my_mod);
   }

None on my side. Are you sure it's not a question of your fonts?

Thanks Frediano. It seems issue with fonts.

Reviewed-by Sudhakar Kuppusamy <[email protected] <mailto:[email protected]>>
Quoted 2 lines

Frediano

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel