Blob Blame History Raw
From b16be5ffc8e700df2b6b2545c4b6794cea71b8e7 Mon Sep 17 00:00:00 2001
From: Arvin Schnell <aschnell@suse.com>
Date: Wed, 27 Jul 2022 13:36:08 +0000
Subject: [PATCH 07/13] parted: Simplify code for json output

_PedDiskOps::get_max_primary_partition_count is always available, the
macro PT_op_function_initializers ensures it. So use
ped_disk_get_max_primary_partition_count instead of
_PedDiskOps::get_max_primary_partition_count directly.

Signed-off-by: Brian C. Lane <bcl@redhat.com>
---
 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.3