[PATCH 4/8] dvh: replace open-coded dvh_clobber with equivalent, shorter code

Jim Meyering meyering at redhat.com
Fri Nov 13 10:39:40 UTC 2009


* libparted/labels/dvh.c (dvh_clobber): Simply use ptt_clear_sectors.
---
 libparted/labels/dvh.c |    7 +------
 1 files changed, 1 insertions(+), 6 deletions(-)

diff --git a/libparted/labels/dvh.c b/libparted/labels/dvh.c
index 2f7db3d..9049b86 100644
--- a/libparted/labels/dvh.c
+++ b/libparted/labels/dvh.c
@@ -98,12 +98,7 @@ dvh_probe (const PedDevice *dev)
 static int
 dvh_clobber (PedDevice* dev)
 {
-	char *zeros = ped_calloc (dev->sector_size);
-	if (zeros == NULL)
-                return 0;
-	int ok = ped_device_write (dev, zeros, 0, 1);
-	free (zeros);
-	return ok;
+	return ptt_clear_sectors (dev, 0, 1);
 }
 #endif /* !DISCOVER_ONLY */

--
1.6.5.2.372.gc0502




More information about the parted-devel mailing list