diff options
author | Arvin Schnell <aschnell@suse.com> | 2022-07-27 13:36:08 +0000 |
---|---|---|
committer | Brian C. Lane <bcl@redhat.com> | 2022-07-27 10:02:08 -0700 |
commit | b16be5ffc8e700df2b6b2545c4b6794cea71b8e7 (patch) | |
tree | d0dc657c2be9b123ded8b0b136a6c99f4c89226b | |
parent | bafa84b25a265ef9eed3872790d52bf56ac42998 (diff) | |
download | parted-b16be5ffc8e700df2b6b2545c4b6794cea71b8e7.tar.gz |
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>
-rw-r--r-- | parted/parted.c | 5 |
1 files 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 { |