[parted-devel] [PATCH] Indentation fixes in libparted/tests/.

Otavio Salvador otavio at debian.org
Wed Apr 18 01:54:20 UTC 2007


From: Debarshi Ray <rishi at gnu.org>

Signed-off-by: Otavio Salvador <otavio at ossystems.com.br>
---
 libparted/tests/common.c |   46 +++++++++++++++++--------------
 libparted/tests/common.h |    1 +
 libparted/tests/label.c  |   68 +++++++++++++++++++++++-----------------------
 3 files changed, 60 insertions(+), 55 deletions(-)

diff --git a/libparted/tests/common.c b/libparted/tests/common.c
index 642da23..409f031 100644
--- a/libparted/tests/common.c
+++ b/libparted/tests/common.c
@@ -8,25 +8,29 @@
 
 char *_create_disk (const off_t size)
 {
-		char *filename = strdup ("parted-test-XXXXXX");
-		if (filename == NULL)
-		  return NULL;
-		int fd = mkstemp (filename);
-		if (fd < 0) {
-	free_filename:;
-			free (filename);
-			return NULL;
-		}
-
-		FILE *disk = fdopen (fd, "w");
-		if (disk == NULL)
-			goto free_filename;
-		off_t total_size = size * 1024 * 1024;	/* Mb */
-
-		int fail = (fseek (disk, total_size, SEEK_SET) != 0
-		            || fwrite ("", sizeof (char), 1, disk) != 1);
-		if (fclose (disk) != 0 || fail)
-			goto free_filename;
-
-		return filename;
+        char *filename = strdup ("parted-test-XXXXXX");
+
+        if (filename == NULL)
+                return NULL;
+
+        int fd = mkstemp (filename);
+        if (fd < 0) {
+        free_filename:
+                free (filename);
+                return NULL;
+        }
+
+        FILE *disk = fdopen (fd, "w");
+        if (disk == NULL)
+                goto free_filename;
+
+        off_t total_size = size * 1024 * 1024;	/* Mb */
+
+        int fail = (fseek (disk, total_size, SEEK_SET) != 0
+                    || fwrite ("", sizeof (char), 1, disk) != 1);
+
+        if (fclose (disk) != 0 || fail)
+                goto free_filename;
+
+        return filename;
 }
diff --git a/libparted/tests/common.h b/libparted/tests/common.h
index 466c218..168175c 100644
--- a/libparted/tests/common.h
+++ b/libparted/tests/common.h
@@ -3,4 +3,5 @@
  * filename: file (with full path) where to write the disk image
  *     size: size of disk image (megabytes)
  */
+
 char *_create_disk(const off_t size);
diff --git a/libparted/tests/label.c b/libparted/tests/label.c
index 1fec681..dfc6d45 100644
--- a/libparted/tests/label.c
+++ b/libparted/tests/label.c
@@ -11,56 +11,56 @@ static char *temporary_disk;
 
 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)
 {
-		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);
-		if (dev == NULL)
-			return;
-		PedDiskType *type;
-		PedDisk *disk;
-
-		for (type = ped_disk_type_get_next(NULL); type;
-			 type = ped_disk_type_get_next(type)) {
-
-				/* Not implemented yet */
-				if (strncmp(type->name, "aix", 3) == 0)
-						continue;
-
-				disk = ped_disk_new_fresh(dev, type);
-				fail_if(!disk, "Failed to create a label of type: %s",
-						 type->name);
-				ped_disk_destroy (disk);
-		}
+        PedDevice *dev = ped_device_get(temporary_disk);
+        if (dev == NULL)
+                return;
+
+        PedDiskType *type;
+        PedDisk *disk;
+
+        for (type = ped_disk_type_get_next(NULL); type;
+             type = ped_disk_type_get_next(type)) {
+
+                /* Not implemented yet */
+                if (strncmp(type->name, "aix", 3) == 0)
+                        continue;
+
+                disk = ped_disk_new_fresh(dev, type);
+                fail_if(!disk, "Failed to create a label of type: %s",
+                        type->name);
+                ped_disk_destroy (disk);
+        }
 }
 END_TEST
 
 int main(void)
 {
-		int number_failed;
-		Suite *suite = suite_create("Disk Label");
-		TCase *tcase_basic = tcase_create("Create");
+        int number_failed;
+        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);
-		suite_add_tcase(suite, tcase_basic);
+        tcase_add_checked_fixture(tcase_basic, create_disk, destroy_disk);
+        tcase_add_test(tcase_basic, test_create_label);
+        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;
+        return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
 }
-- 
1.5.1




More information about the parted-devel mailing list