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

Otavio Salvador otavio at ossystems.com.br
Fri Apr 20 13:04:55 UTC 2007


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;
 }
-- 
1.5.0.5




More information about the parted-devel mailing list