[parted-devel] [PATCH 1/3] Use sizeof(variable) instead of sizeof(type)

Petr Uzel petr.uzel at suse.cz
Wed Aug 26 10:28:41 UTC 2009


* libparted/labels/dos.c (write_ext_table): use sizeof(variable)
  instead of sizeof(type)
* libparted/labels/dos.c (write_empty_table): likewise
* libparted/labels/dos.c (msdos_write): likewise

Signed-off-by: Petr Uzel <petr.uzel at suse.cz>
---
 libparted/labels/dos.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/libparted/labels/dos.c b/libparted/labels/dos.c
index 2b1aaca..f67a872 100644
--- a/libparted/labels/dos.c
+++ b/libparted/labels/dos.c
@@ -1040,7 +1040,7 @@ write_ext_table (const PedDisk* disk,
 		return 0;
 
 	DosRawTable *table = s;
-	memset(&(table->partitions), 0, 4 * sizeof(DosRawPartition));
+	memset(&(table->partitions), 0, sizeof (table->partitions));
 	table->magic = PED_CPU_TO_LE16 (MSDOS_MAGIC);
 
 	int ok = 0;
@@ -1080,10 +1080,10 @@ write_empty_table (const PedDisk* disk, PedSector sector)
 	PED_ASSERT (disk != NULL, return 0);
 
 	if (ptt_read_sector (disk->dev, sector, &table_sector)) {
-		memcpy (&table, table_sector, sizeof(DosRawTable));
+		memcpy (&table, table_sector, sizeof (table));
 		free(table_sector);
 	}
-	memset (&(table.partitions), 0, 4 * sizeof(DosRawPartition));
+	memset (&(table.partitions), 0, sizeof (table.partitions));
 	table.magic = PED_CPU_TO_LE16 (MSDOS_MAGIC);
 
 	return ped_device_write (disk->dev, (void*) &table, sector, 1);
@@ -1142,7 +1142,7 @@ msdos_write (const PedDisk* disk)
 	if (!table->mbr_signature)
 		table->mbr_signature = generate_random_id();
 
-	memset (table->partitions, 0, sizeof (DosRawPartition) * 4);
+	memset (table->partitions, 0, sizeof (table->partitions));
 	table->magic = PED_CPU_TO_LE16 (MSDOS_MAGIC);
 
 	for (i=1; i<=4; i++) {
-- 
1.6.3.3


-- 
Best regards / s pozdravem

Petr Uzel, openSUSE Community Multiplier Team
-----------------------------------------------------------------
SUSE LINUX, s.r.o.                          e-mail: puzel at suse.cz
Lihovarská 1060/12                          http://www.suse.cz
190 00 Prague 9, CR                             
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/parted-devel/attachments/20090826/2b67f8ac/attachment-0001.pgp>


More information about the parted-devel mailing list