From 6cde215e0ef16a8311d72ae3ab719bf796027477 Mon Sep 17 00:00:00 2001 From: Slava Zanko Date: Sat, 23 Jul 2011 16:18:53 +0300 Subject: [PATCH] Added inline function vfs_path_get_last_path_str() ...to simple get path string without malloc/free operations. Signed-off-by: Slava Zanko --- lib/vfs/path.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/vfs/path.h b/lib/vfs/path.h index d7efb6124..59941e225 100644 --- a/lib/vfs/path.h +++ b/lib/vfs/path.h @@ -79,4 +79,16 @@ vfs_path_element_valid (const vfs_path_element_t * element) return (element != NULL && element->class != NULL); } +/* --------------------------------------------------------------------------------------------- */ + +static inline char * +vfs_path_get_last_path_str (const vfs_path_t * vpath) +{ + const vfs_path_element_t *element; + if (vpath == NULL) + return NULL; + element = vfs_path_get_by_index (vpath, -1); + return (element != NULL) ? element->path : NULL; +} + #endif -- 2.11.4.GIT