[PATCH 2/3] rename all "support" parameters; avoid new compiler warnings

Jim Meyering meyering at redhat.com
Thu Mar 5 10:42:45 UTC 2009


Change each occurrence like this (which evokes a warning from gcc):
-	return *supported = MAX_TOTAL_PART;
to this:
+	*max_n = MAX_TOTAL_PART;
+	return true;

I did it mostly mechanically:

  cd libparted/labels &&
    grep -l 'return .supported = ' *.c|xargs perl -ni \
      -e '$m=/^\treturn \*supported( = .*;)/;' \
      -e 'print $m ? "\t*max_n$1\n\treturn true;\n" : $_'
  git grep -l 'int\* supported'|xargs perl -pi -e 's/int\* supported/int *max_n/'

That got all but aix.c, which used different spacing: "int *supported",
which I changed manually.  Then I updated all copyright dates.
---
 libparted/labels/aix.c  |    7 ++++---
 libparted/labels/bsd.c  |    7 ++++---
 libparted/labels/dasd.c |    5 +++--
 libparted/labels/dos.c  |    7 ++++---
 libparted/labels/dvh.c  |    7 ++++---
 libparted/labels/loop.c |    7 ++++---
 libparted/labels/mac.c  |    7 ++++---
 libparted/labels/pc98.c |    7 ++++---
 libparted/labels/rdb.c  |    7 ++++---
 libparted/labels/sun.c  |    7 ++++---
 10 files changed, 39 insertions(+), 29 deletions(-)

diff --git a/libparted/labels/aix.c b/libparted/labels/aix.c
index 2d8a40c..465cb6c 100644
--- a/libparted/labels/aix.c
+++ b/libparted/labels/aix.c
@@ -1,7 +1,7 @@
 /* -*- Mode: c; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-

     libparted - a library for manipulating disk partitions
-    Copyright (C) 2000, 2001, 2007 Free Software Foundation, Inc.
+    Copyright (C) 2000, 2001, 2007, 2009 Free Software Foundation, Inc.

     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -224,9 +224,10 @@ aix_get_max_primary_partition_count (const PedDisk* disk)
 }

 static bool
-aix_get_max_supported_partition_count (const PedDisk* disk, int *supported)
+aix_get_max_supported_partition_count (const PedDisk* disk, int *max_n)
 {
-	return *supported = MAX_TOTAL_PART;
+	*max_n = MAX_TOTAL_PART;
+	return true;
 }

 static int
diff --git a/libparted/labels/bsd.c b/libparted/labels/bsd.c
index 55af468..83e1709 100644
--- a/libparted/labels/bsd.c
+++ b/libparted/labels/bsd.c
@@ -1,7 +1,7 @@
 /* -*- Mode: c; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-

     libparted - a library for manipulating disk partitions
-    Copyright (C) 2000, 2001, 2007 Free Software Foundation, Inc.
+    Copyright (C) 2000, 2001, 2007, 2009 Free Software Foundation, Inc.

     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -549,9 +549,10 @@ bsd_get_max_primary_partition_count (const PedDisk* disk)
 }

 static bool
-bsd_get_max_supported_partition_count(const PedDisk* disk, int* supported)
+bsd_get_max_supported_partition_count(const PedDisk* disk, int *max_n)
 {
-	return *supported = BSD_MAXPARTITIONS;
+	*max_n = BSD_MAXPARTITIONS;
+	return true;
 }

 static PedConstraint*
diff --git a/libparted/labels/dasd.c b/libparted/labels/dasd.c
index 35cfbb3..3a0bb32 100644
--- a/libparted/labels/dasd.c
+++ b/libparted/labels/dasd.c
@@ -716,9 +716,10 @@ dasd_get_max_primary_partition_count (const PedDisk* disk)
 }

 static bool
-dasd_get_max_supported_partition_count (const PedDisk* disk, int* supported)
+dasd_get_max_supported_partition_count (const PedDisk* disk, int *max_n)
 {
-	return *supported = dasd_get_max_primary_partition_count(disk);
+	*max_n = dasd_get_max_primary_partition_count(disk);
+	return true;
 }

 static PedConstraint*
diff --git a/libparted/labels/dos.c b/libparted/labels/dos.c
index 92b728d..a0044b7 100644
--- a/libparted/labels/dos.c
+++ b/libparted/labels/dos.c
@@ -1,6 +1,6 @@
 /*
     libparted - a library for manipulating disk partitions
-    Copyright (C) 1999, 2000, 2001, 2004, 2005, 2007
+    Copyright (C) 1999, 2000, 2001, 2004, 2005, 2007, 2009
     Free Software Foundation, Inc.

     This program is free software; you can redistribute it and/or modify
@@ -2215,9 +2215,10 @@ msdos_get_max_primary_partition_count (const PedDisk* disk)
 }

 static bool
-msdos_get_max_supported_partition_count(const PedDisk* disk, int* supported)
+msdos_get_max_supported_partition_count(const PedDisk* disk, int *max_n)
 {
-	return *supported = MAX_TOTAL_PART;
+	*max_n = MAX_TOTAL_PART;
+	return true;
 }

 static PedDiskOps msdos_disk_ops = {
diff --git a/libparted/labels/dvh.c b/libparted/labels/dvh.c
index 3814824..38b7569 100644
--- a/libparted/labels/dvh.c
+++ b/libparted/labels/dvh.c
@@ -1,6 +1,6 @@
 /*
     libparted - a library for manipulating disk partitions
-    Copyright (C) 2001, 2002, 2005, 2007-2008 Free Software Foundation, Inc.
+    Copyright (C) 2001, 2002, 2005, 2007-2009 Free Software Foundation, Inc.

     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -823,9 +823,10 @@ dvh_get_max_primary_partition_count (const PedDisk* disk)
 }

 static bool
-dvh_get_max_supported_partition_count (const PedDisk* disk, int* supported)
+dvh_get_max_supported_partition_count (const PedDisk* disk, int *max_n)
 {
-	return *supported = NPARTAB;
+	*max_n = NPARTAB;
+	return true;
 }


diff --git a/libparted/labels/loop.c b/libparted/labels/loop.c
index 23e0d3c..c89a9ce 100644
--- a/libparted/labels/loop.c
+++ b/libparted/labels/loop.c
@@ -1,6 +1,6 @@
 /*
     libparted - a library for manipulating disk partitions
-    Copyright (C) 1999, 2000, 2007 Free Software Foundation, Inc.
+    Copyright (C) 1999, 2000, 2007, 2009 Free Software Foundation, Inc.

     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -282,9 +282,10 @@ loop_get_max_primary_partition_count (const PedDisk* disk)
 }

 static bool
-loop_get_max_supported_partition_count (const PedDisk* disk, int* supported)
+loop_get_max_supported_partition_count (const PedDisk* disk, int *max_n)
 {
-	return *supported = 1;
+	*max_n = 1;
+	return true;
 }

 static PedDiskOps loop_disk_ops = {
diff --git a/libparted/labels/mac.c b/libparted/labels/mac.c
index db22aa8..e89dc20 100644
--- a/libparted/labels/mac.c
+++ b/libparted/labels/mac.c
@@ -1,6 +1,6 @@
 /*
     libparted - a library for manipulating disk partitions
-    Copyright (C) 2000, 2002, 2004, 2007-2008 Free Software Foundation, Inc.
+    Copyright (C) 2000, 2002, 2004, 2007-2009 Free Software Foundation, Inc.

     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -1565,9 +1565,10 @@ mac_get_max_primary_partition_count (const PedDisk* disk)
 }

 static bool
-mac_get_max_supported_partition_count (const PedDisk* disk, int* supported)
+mac_get_max_supported_partition_count (const PedDisk* disk, int *max_n)
 {
-	return *supported = 65536;
+	*max_n = 65536;
+	return true;
 }

 static PedDiskOps mac_disk_ops = {
diff --git a/libparted/labels/pc98.c b/libparted/labels/pc98.c
index ff21750..3ab7b03 100644
--- a/libparted/labels/pc98.c
+++ b/libparted/labels/pc98.c
@@ -1,6 +1,6 @@
 /*
     libparted - a library for manipulating disk partitions
-    Copyright (C) 2000, 2001, 2007-2008 Free Software Foundation, Inc.
+    Copyright (C) 2000, 2001, 2007-2009 Free Software Foundation, Inc.

     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -833,9 +833,10 @@ pc98_get_max_primary_partition_count (const PedDisk* disk)
 }

 static bool
-pc98_get_max_supported_partition_count (const PedDisk* disk, int* supported)
+pc98_get_max_supported_partition_count (const PedDisk* disk, int *max_n)
 {
-	return *supported = MAX_PART_COUNT;
+	*max_n = MAX_PART_COUNT;
+	return true;
 }

 static PedDiskOps pc98_disk_ops = {
diff --git a/libparted/labels/rdb.c b/libparted/labels/rdb.c
index 43496dc..90acc2b 100644
--- a/libparted/labels/rdb.c
+++ b/libparted/labels/rdb.c
@@ -2,7 +2,7 @@

     libparted - a library for manipulating disk partitions
     disk_amiga.c - libparted module to manipulate amiga RDB partition tables.
-    Copyright (C) 2000, 2001, 2004, 2007-2008 Free Software Foundation, Inc.
+    Copyright (C) 2000, 2001, 2004, 2007-2009 Free Software Foundation, Inc.

     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -1125,9 +1125,10 @@ amiga_get_max_primary_partition_count (const PedDisk* disk)
 }

 static bool
-amiga_get_max_supported_partition_count (const PedDisk* disk, int* supported)
+amiga_get_max_supported_partition_count (const PedDisk* disk, int *max_n)
 {
-	return *supported = AMIGA_MAX_PARTITIONS;
+	*max_n = AMIGA_MAX_PARTITIONS;
+	return true;
 }

 static PedDiskOps amiga_disk_ops = {
diff --git a/libparted/labels/sun.c b/libparted/labels/sun.c
index 7c43240..389db47 100644
--- a/libparted/labels/sun.c
+++ b/libparted/labels/sun.c
@@ -1,7 +1,7 @@
 /* -*- Mode: c; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-

     libparted - a library for manipulating disk partitions
-    Copyright (C) 2000, 2001, 2005, 2007-2008 Free Software Foundation, Inc.
+    Copyright (C) 2000, 2001, 2005, 2007-2009 Free Software Foundation, Inc.

     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -665,9 +665,10 @@ sun_partition_is_flag_available (const PedPartition* part,
 }

 static bool
-sun_get_max_supported_partition_count (const PedDisk* disk, int* supported)
+sun_get_max_supported_partition_count (const PedDisk* disk, int *max_n)
 {
-	return *supported = SUN_DISK_MAXPARTITIONS;
+	*max_n = SUN_DISK_MAXPARTITIONS;
+	return true;
 }

 static int
--
1.6.2.rc1.285.gc5f54




More information about the parted-devel mailing list