Petr Uzel wrote:

> On Wed, May 26, 2010 at 07:18:12PM +0200, Jim Meyering wrote:
>> Petr Uzel wrote:
>> > * parted/parted.c (do_align_check): rework the function so that
>> > it reports partition alignment in interactive mode as described in
>> > documentation.
>> > ---
>> >  parted/parted.c |   21 ++++++++++++++++-----
>> >  1 files changed, 16 insertions(+), 5 deletions(-)
>> >
>> > diff --git a/parted/parted.c b/parted/parted.c
>> > index 830075b..7198b92 100644
>> > --- a/parted/parted.c
>> > +++ b/parted/parted.c
>> > @@ -2078,18 +2078,29 @@ do_align_check (PedDevice **dev)
>> >  {
>> >    PedDisk *disk = ped_disk_new (*dev);
>> >    if (!disk)
>> > -    return 0;
>> > +    goto error;
>> >
>> >    enum AlignmentType align_type = PA_OPTIMUM;
>> >    PedPartition *part = NULL;
>> > -  bool aligned =
>> > -    (command_line_get_align_type (_("alignment type(min/opt)"), 
>> > &align_type)
>> > -     && command_line_get_partition (_("Partition number?"), disk, &part)
>> > -     && partition_align_check (disk, part, align_type));
>> > +
>> > +  if (!command_line_get_align_type (_("alignment type(min/opt)"), 
>> > &align_type))
>> > +    goto error_destroy_disk;
>> > +  if (!command_line_get_partition (_("Partition number?"), disk, &part))
>> > +    goto error_destroy_disk;
>> > +
>> > +  bool aligned = partition_align_check (disk, part, align_type);
>> > +  if (!opt_script_mode)
>> > +    printf(aligned ? _("%d aligned\n") : _("%d NOT aligned\n"), 
>> > part->num);
>>
>> Thanks.  Applied modulo this:
>>
>> -    printf(aligned ? _("%d aligned\n") : _("%d NOT aligned\n"), part->num);
>> +    printf(aligned ? _("%d aligned\n") : _("%d not aligned\n"), part->num);
>>
>> since the documentation says lower case "not".
>>
>>     doc/parted.texi:or @sa...@var{n} not aligned}.
>
> Ah, sure, thanks.
>
> What about the 'FIXME:' part in original patch? It seems to work fine
> as is, but perhaps I'm missing something...

That return code appears to be unused in interactive mode.

  # ./parted /dev/sdd
  GNU Parted 2.2.76-33c1
  Using /dev/sdd
  Welcome to GNU Parted! Type 'help' to view a list of commands.
  (parted) align-check opt 1
  1 not aligned
  (parted) q

How about just removing the FIXME comment?

>From b177eec755b7366c8e776e0962b01999e58ba8bf Mon Sep 17 00:00:00 2001
From: Jim Meyering <[email protected]>
Date: Thu, 27 May 2010 11:59:22 +0200
Subject: [PATCH] maint: remove a FIXME comment

* parted/parted.c (do_align_check): The value returned
by this function is ignored in interactive mode, so remove
the FIXME comment.
---
 parted/parted.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/parted/parted.c b/parted/parted.c
index 7723d18..45ae98c 100644
--- a/parted/parted.c
+++ b/parted/parted.c
@@ -2094,7 +2094,6 @@ do_align_check (PedDevice **dev)

   ped_disk_destroy (disk);

-  /* FIXME: perhaps we should always return 1 when in interactive mode???  */
   return aligned ? 1 : 0;

 error_destroy_disk:
--
1.7.1.348.gb26ba

_______________________________________________
parted-devel mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/parted-devel

Reply via email to