[parted-devel] [PATCH 1/6] libparted: refactor device-mapper partition sync code

Jim Meyering jim at meyering.net
Wed Oct 17 14:50:08 UTC 2012


Jim Meyering wrote:
...
> -static char *dm_canonical_path (PedDevice *dev)
> +static char *
> +dm_canonical_path (PedDevice *dev)
>  {

Another thing: please make a point to declare all pointers "const"
unless they point to something that is modified.  This is called
"const correctness", and helps avoid having to add unnecessary
casts, and also helps make the code more readable and less
error prone.

I'm folding this in along with the rest:

diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
index b3909a0..12ea6b5 100644
--- a/libparted/arch/linux.c
+++ b/libparted/arch/linux.c
@@ -2226,7 +2226,7 @@ zasprintf (const char *format, ...)
 }

 static char *
-dm_canonical_path (PedDevice *dev)
+dm_canonical_path (PedDevice const *dev)
 {
         LinuxSpecific*  arch_specific = LINUX_SPECIFIC (dev);



More information about the parted-devel mailing list