[lvm-devel] LVM2 lib/misc/last-path-component.h tools/lvmc ...

zkabelac at sourceware.org zkabelac at sourceware.org
Wed Nov 12 09:53:34 UTC 2008


CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	zkabelac at sourceware.org	2008-11-12 09:53:33

Modified files:
	lib/misc       : last-path-component.h 
	tools          : lvmcmdline.c 

Log message:
	cleaner const char* usage for last_path_component()

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/misc/last-path-component.h.diff?cvsroot=lvm2&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvmcmdline.c.diff?cvsroot=lvm2&r1=1.73&r2=1.74

--- LVM2/lib/misc/last-path-component.h	2008/07/31 15:38:51	1.2
+++ LVM2/lib/misc/last-path-component.h	2008/11/12 09:53:33	1.3
@@ -19,10 +19,9 @@
 
 #include <string.h>
 
-static inline char *last_path_component(char const *name)
+static inline const char *last_path_component(char const *name)
 {
 	char const *slash = strrchr(name, '/');
-	char const *res = slash ? slash + 1 : name;
 
-	return (char *)res;
+	return (slash) ? slash + 1 : name;
 }
--- LVM2/tools/lvmcmdline.c	2008/11/12 09:49:06	1.73
+++ LVM2/tools/lvmcmdline.c	2008/11/12 09:53:33	1.74
@@ -483,7 +483,7 @@
 static struct command *_find_command(const char *name)
 {
 	int i;
-	char *base;
+	const char *base;
 
 	base = last_path_component(name);
 




More information about the lvm-devel mailing list