Skip to contentSkip to conversation

LVM2 lib/misc/last-path-component.h tools/lvmc ...

PATCH [email protected] 1 participant 1 message Nov 12, 2008

lore
Share & tools
lore
#0 lore raw

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

lib/misc/last-path-component.h +2 -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;
 }
tools/lvmcmdline.c +1 -1
@@ -483,7 +483,7 @@
 static struct command *_find_command(const char *name)
 {
 	int i;
-	char *base;
+	const char *base;
 
 	base = last_path_component(name);