[parted-devel] [PATCH 0/1] simplify code

Arvin Schnell aschnell at suse.com
Wed Jul 27 14:36:08 BST 2022


Use ped_disk_get_max_primary_partition_count instead of
_PedDiskOps::get_max_primary_partition_count directly.

---
 parted/parted.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/parted/parted.c b/parted/parted.c
index 96da30d..36c39c7 100644
--- a/parted/parted.c
+++ b/parted/parted.c
@@ -1215,9 +1215,8 @@ _print_disk_info (const PedDevice *dev, const PedDisk *diskp)
             ul_jsonwrt_value_u64 (&json, "physical-sector-size", dev->phys_sector_size);
             ul_jsonwrt_value_s (&json, "label", pt_name);
             if (diskp) {
-                if (diskp->type->ops->get_max_primary_partition_count)
-                    ul_jsonwrt_value_u64 (&json, "max-partitions",
-                                          diskp->type->ops->get_max_primary_partition_count(diskp));
+                ul_jsonwrt_value_u64 (&json, "max-partitions",
+                                      ped_disk_get_max_primary_partition_count(diskp));
                 disk_print_flags_json (diskp);
             }
         } else {
-- 
2.37.1




More information about the parted-devel mailing list