[parted-devel] [PATCH 8/8] libparted: optimize _disk_sync_part_table

Jim Meyering jim at meyering.net
Sat Oct 1 07:36:19 UTC 2011


Petr Uzel wrote:
> In _disk_sync_part_table, if the largest partition number (lpn) is
> 0, it does not make sense to go through the loops below. Return
> immediately instead.
>
> * libparted/arch/linux.c (_disk_sync_part_table): Return immediately
> if lpn == 0.
> ---
>  libparted/arch/linux.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
> index b6f7e0b..216fe8b 100644
> --- a/libparted/arch/linux.c
> +++ b/libparted/arch/linux.c
> @@ -2475,7 +2475,7 @@ _disk_sync_part_table (PedDisk* disk)
>          /* Its not possible to support largest_partnum < 0.
>           * largest_partnum == 0 would mean does not support partitions.
>           * */
> -        if (lpn < 0)
> +        if (lpn < 1)
>                  return 0;

Looks fine.  Thanks.



More information about the parted-devel mailing list