[parted-devel] [PATCH] [tests] Fix spacing around brackets and asterisks.

David Cantrell dcantrell at redhat.com
Fri Apr 20 14:49:54 UTC 2007


On Fri, 2007-04-20 at 10:04 -0300, Otavio Salvador wrote:
> From: Debarshi Ray <rishi at gnu.org>
> 
> ---
>  libparted/tests/common.c |   27 +++++++++++---------
>  libparted/tests/common.h |    6 ++--
>  libparted/tests/label.c  |   62 ++++++++++++++++++++++++---------------------
>  3 files changed, 51 insertions(+), 44 deletions(-)
> 
> diff --git a/libparted/tests/common.c b/libparted/tests/common.c
> index 07f716f..ab2c0ac 100644
> --- a/libparted/tests/common.c
> +++ b/libparted/tests/common.c
> @@ -8,9 +8,10 @@
>  
>  #include "common.h"
>  
> -char *_create_disk (const off_t size)
> +char*
> +_create_disk (const off_t size)
>  {
> -        char *filename = strdup ("parted-test-XXXXXX");
> +        char* filename = strdup ("parted-test-XXXXXX");
>  
>          if (filename == NULL)
>                  return NULL;
> @@ -22,7 +23,7 @@ char *_create_disk (const off_t size)
>                  return NULL;
>          }
>  
> -        FILE *disk = fdopen (fd, "w");
> +        FILE* disk = fdopen (fd, "w");
>          if (disk == NULL)
>                  goto free_filename;
>  
> @@ -37,24 +38,26 @@ char *_create_disk (const off_t size)
>          return filename;
>  }
>  
> -PedDisk *_create_disk_label(PedDevice *dev, PedDiskType *type)
> +PedDisk*
> +_create_disk_label (PedDevice *dev, PedDiskType *type)
>  {
> -        PedDisk *disk = NULL;
> +        PedDisk* disk = NULL;
>  
>          /* Create the label */
> -        disk = ped_disk_new_fresh(dev, type);
> -        fail_if(!disk, "Failed to create a label of type: %s",
> -                type->name);
> -        fail_if(!ped_disk_commit(disk),
> -                "Failed to commit label to device");
> +        disk = ped_disk_new_fresh (dev, type);
> +        fail_if (!disk, "Failed to create a label of type: %s",
> +                 type->name);
> +        fail_if (!ped_disk_commit(disk),
> +		 "Failed to commit label to device");
>  
>          return disk;
>  }
>  
> -int _implemented_disk_label (const char *label)
> +int
> +_implemented_disk_label (const char *label)
>  {
>          /* Not implemented yet */
> -        if (strncmp(label, "aix", 3) == 0)
> +        if (strncmp (label, "aix", 3) == 0)
>                  return 0;
>          
>          return 1;
> diff --git a/libparted/tests/common.h b/libparted/tests/common.h
> index b2b5d3b..91230b1 100644
> --- a/libparted/tests/common.h
> +++ b/libparted/tests/common.h
> @@ -5,17 +5,17 @@
>   * filename: file (with full path) where to write the disk image
>   *     size: size of disk image (megabytes)
>   */
> -char *_create_disk(const off_t size);
> +char* _create_disk (const off_t size);
>  
>  /* Create a disk label
>   *
>   *  dev: device to use when creating the label
>   * type: label type
>   */
> -PedDisk *_create_disk_label(PedDevice *dev, PedDiskType *type);
> +PedDisk* _create_disk_label (PedDevice* dev, PedDiskType* type);
>  
>  /* Return if a disk label is implemented
>   *
>   * label: disk label name
>   */
> -int _implemented_disk_label(const char *label);
> +int _implemented_disk_label (const char* label);
> diff --git a/libparted/tests/label.c b/libparted/tests/label.c
> index 244dd5d..563c4eb 100644
> --- a/libparted/tests/label.c
> +++ b/libparted/tests/label.c
> @@ -7,65 +7,69 @@
>  
>  #include "common.h"
>  
> -static char *temporary_disk;
> +static char* temporary_disk;
>  
> -static void create_disk(void)
> +static void
> +create_disk (void)
>  {
> -        temporary_disk = _create_disk(20);
> -        fail_if(temporary_disk == NULL, "Failed to create temporary disk");
> +        temporary_disk = _create_disk (20);
> +        fail_if (temporary_disk == NULL, "Failed to create temporary disk");
>  }
>  
> -static void destroy_disk(void)
> +static void
> +destroy_disk (void)
>  {
> -        unlink(temporary_disk);
> -        free(temporary_disk);
> +        unlink (temporary_disk);
> +        free (temporary_disk);
>  }
>  
>  /* TEST: Create a disklabel on a simple disk image */
>  START_TEST (test_create_label)
>  {
> -        PedDevice *dev = ped_device_get(temporary_disk);
> +        PedDevice* dev = ped_device_get (temporary_disk);
>          if (dev == NULL)
>                  return;
>  
> -        PedDiskType *type;
> -        PedDisk *disk;
> +        PedDiskType* type;
> +        PedDisk* disk;
>  
> -        for (type = ped_disk_type_get_next(NULL); type;
> -             type = ped_disk_type_get_next(type)) {
> -                if (!_implemented_disk_label(type->name))
> +        for (type = ped_disk_type_get_next (NULL); type;
> +             type = ped_disk_type_get_next (type)) {
> +                if (!_implemented_disk_label (type->name))
>                          continue;
>  
>                  disk = _create_disk_label (dev, type);
>                  ped_disk_destroy (disk);
>  
>                  /* Try to read the label */
> -                disk = ped_disk_new(dev);
> -                fail_if(!disk,
> -                        "Failed to read the just created label of type: %s",
> -                        type->name);
> -                ped_disk_destroy(disk);
> +                disk = ped_disk_new (dev);
> +                fail_if (!disk,
> +			 "Failed to read the just created label of type: %s",
> +                         type->name);
> +                ped_disk_destroy (disk);
>          }
>          ped_device_destroy (dev);
>  }
>  END_TEST
>  
> -int main(void)
> +int
> +main (void)
>  {
>          int number_failed;
> -        Suite *suite = suite_create("Disk Label");
> -        TCase *tcase_basic = tcase_create("Create");
> +        Suite* suite = suite_create ("Disk Label");
> +        TCase* tcase_basic = tcase_create ("Create");
>  
> -        tcase_add_checked_fixture(tcase_basic, create_disk, destroy_disk);
> -        tcase_add_test(tcase_basic, test_create_label);
> -        tcase_set_timeout(tcase_basic, 0); /* disable timeout for this tests */
> -        suite_add_tcase(suite, tcase_basic);
> +        tcase_add_checked_fixture (tcase_basic, create_disk, destroy_disk);
> +        tcase_add_test (tcase_basic, test_create_label);
> +        /* Disable timeout for this test */
> +        tcase_set_timeout (tcase_basic, 0);
> +        suite_add_tcase (suite, tcase_basic);
>  
> -        SRunner *srunner = srunner_create(suite);
> -        srunner_run_all(srunner, CK_VERBOSE);
> +        SRunner* srunner = srunner_create (suite);
> +        srunner_run_all (srunner, CK_VERBOSE);
>  
> -        number_failed = srunner_ntests_failed(srunner);
> -        srunner_free(srunner);
> +        number_failed = srunner_ntests_failed (srunner);
> +        srunner_free (srunner);
>  
>          return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
>  }

Pretty sure I just read this, but ACK.

-- 
David Cantrell <dcantrell at redhat.com>
Red Hat / Westford, MA
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.alioth.debian.org/pipermail/parted-devel/attachments/20070420/cde345d1/attachment-0001.pgp


More information about the parted-devel mailing list