[parted-devel] Add "const" to parameters in some public interfaces.

Jim Meyering jim at meyering.net
Wed Mar 7 18:17:47 CET 2007


FYI.  just pushed:

David signed off on making ped_partition_print private.

	Add "const" to parameters in these public interfaces.
	* libparted/disk.c (ped_disk_check):
	(ped_disk_get_primary_partition_count):
	(ped_disk_get_last_partition_num, ped_partition_print):
	(ped_disk_print):
	(ped_partition_print): Also declare to be "static".
	This is ok, since the function is referenced only from this file.
	* include/parted/disk.h: Update their prototypes.

diff --git a/include/parted/disk.h b/include/parted/disk.h
index 06ecfbb..6771809 100644
--- a/include/parted/disk.h
+++ b/include/parted/disk.h
@@ -257,11 +257,11 @@ extern void ped_disk_destroy (PedDisk* disk);
 extern int ped_disk_commit (PedDisk* disk);
 extern int ped_disk_commit_to_dev (PedDisk* disk);
 extern int ped_disk_commit_to_os (PedDisk* disk);
-extern int ped_disk_check (PedDisk* disk);
-extern void ped_disk_print (PedDisk* disk);
+extern int ped_disk_check (const PedDisk* disk);
+extern void ped_disk_print (const PedDisk* disk);

-extern int ped_disk_get_primary_partition_count (PedDisk* disk);
-extern int ped_disk_get_last_partition_num (PedDisk* disk);
+extern int ped_disk_get_primary_partition_count (const PedDisk* disk);
+extern int ped_disk_get_last_partition_num (const PedDisk* disk);
 extern int ped_disk_get_max_primary_partition_count (const PedDisk* disk);

 /** @} */
diff --git a/libparted/disk.c b/libparted/disk.c
index 2cb961d..c678d65 100644
--- a/libparted/disk.c
+++ b/libparted/disk.c
@@ -563,7 +563,7 @@ ped_partition_get_path (const PedPartition* part)
  * \return 0 if the check fails, 1 otherwise.
  */
 int
-ped_disk_check (PedDisk* disk)
+ped_disk_check (const PedDisk* disk)
 {
 	PedPartition*	walk;

@@ -626,7 +626,7 @@ ped_disk_type_check_feature (const PedDiskType* disk_type,
  * Get the number of primary partitions.
  */
 int
-ped_disk_get_primary_partition_count (PedDisk* disk)
+ped_disk_get_primary_partition_count (const PedDisk* disk)
 {
 	PedPartition*	walk;
 	int		count = 0;
@@ -647,7 +647,7 @@ ped_disk_get_primary_partition_count (PedDisk* disk)
  * Get the highest partition number on \p disk.
  */
 int
-ped_disk_get_last_partition_num (PedDisk* disk)
+ped_disk_get_last_partition_num (const PedDisk* disk)
 {
 	PedPartition*	walk;
 	int		highest = -1;
@@ -2228,8 +2228,8 @@ ped_partition_flag_get_by_name (const char* name)
 	return 0;
 }

-void
-ped_partition_print (PedPartition* part)
+static void
+ped_partition_print (const PedPartition* part)
 {
 	PED_ASSERT (part != NULL, return);

@@ -2251,7 +2251,7 @@ ped_partition_print (PedPartition* part)
  * Prints a summary of disk's partitions.  Useful for debugging.
  */
 void
-ped_disk_print (PedDisk* disk)
+ped_disk_print (const PedDisk* disk)
 {
 	PedPartition*	part;




More information about the parted-devel mailing list