From e9db0a0c12fafda82801034a155c99094b33a235 Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Sat, 27 Jun 2015 16:27:41 +0300 Subject: [PATCH] (vfs_canon): merge local variables. --- lib/vfs/path.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/lib/vfs/path.c b/lib/vfs/path.c index 1b3b84fc3..d2bb5b0ec 100644 --- a/lib/vfs/path.c +++ b/lib/vfs/path.c @@ -135,13 +135,16 @@ _vfs_split_with_semi_skip_count (char *path, const char **inpath, const char **o static char * vfs_canon (const char *path) { + char *result; + if (path == NULL) vfs_die ("Cannot canonicalize NULL"); - /* Relative to current directory */ if (!IS_PATH_SEP (*path)) { - char *result, *local; + /* Relative to current directory */ + + char *local; if (g_str_has_prefix (path, VFS_ENCODING_PREFIX)) { @@ -161,20 +164,16 @@ vfs_canon (const char *path) } result = vfs_canon (local); g_free (local); - return result; } - - /* - * So we have path of following form: - * /p1/p2#op/.././././p3#op/p4. Good luck. - */ + else { - char *result; + /* Absolute path */ result = g_strdup (path); canonicalize_pathname (result); - return result; } + + return result; } /* --------------------------------------------------------------------------------------------- */ -- 2.11.4.GIT