[libvirt] [PATCH 1/3] util: Remove virFileSkipRoot()

Fabiano Fidêncio fidencio at redhat.com
Wed Dec 18 19:59:01 UTC 2019


The function is no longer used since commit faf2d811f3e9a4.

Signed-off-by: Fabiano Fidêncio <fidencio at redhat.com>
---
 src/libvirt_private.syms |  1 -
 src/util/virfile.c       | 54 ----------------------------------------
 src/util/virfile.h       |  1 -
 3 files changed, 56 deletions(-)

diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 9852f5d4a6..797c15bb42 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -2038,7 +2038,6 @@ virFileSanitizePath;
 virFileSetACLs;
 virFileSetupDev;
 virFileSetXAttr;
-virFileSkipRoot;
 virFileTouch;
 virFileUnlock;
 virFileUpdatePerm;
diff --git a/src/util/virfile.c b/src/util/virfile.c
index 4fd865dd83..624bd9e3d0 100644
--- a/src/util/virfile.c
+++ b/src/util/virfile.c
@@ -3197,60 +3197,6 @@ virFileIsAbsPath(const char *path)
     return false;
 }
 
-
-const char *
-virFileSkipRoot(const char *path)
-{
-#ifdef WIN32
-    /* Skip \\server\share or //server/share */
-    if (VIR_FILE_IS_DIR_SEPARATOR(path[0]) &&
-        VIR_FILE_IS_DIR_SEPARATOR(path[1]) &&
-        path[2] &&
-        !VIR_FILE_IS_DIR_SEPARATOR(path[2]))
-    {
-        const char *p = strchr(path + 2, VIR_FILE_DIR_SEPARATOR);
-        const char *q = strchr(path + 2, '/');
-
-        if (p == NULL || (q != NULL && q < p))
-            p = q;
-
-        if (p && p > path + 2 && p[1]) {
-            path = p + 1;
-
-            while (path[0] &&
-                   !VIR_FILE_IS_DIR_SEPARATOR(path[0]))
-                path++;
-
-            /* Possibly skip a backslash after the share name */
-            if (VIR_FILE_IS_DIR_SEPARATOR(path[0]))
-                path++;
-
-            return path;
-        }
-    }
-#endif
-
-    /* Skip initial slashes */
-    if (VIR_FILE_IS_DIR_SEPARATOR(path[0])) {
-        while (VIR_FILE_IS_DIR_SEPARATOR(path[0]))
-            path++;
-
-        return path;
-    }
-
-#ifdef WIN32
-    /* Skip X:\ */
-    if (g_ascii_isalpha(path[0]) &&
-        path[1] == ':' &&
-        VIR_FILE_IS_DIR_SEPARATOR(path[2]))
-        return path + 3;
-#endif
-
-    return path;
-}
-
-
-
 /*
  * Creates an absolute path for a potentially relative path.
  * Return 0 if the path was not relative, or on success.
diff --git a/src/util/virfile.h b/src/util/virfile.h
index bcae40ee06..80641f763a 100644
--- a/src/util/virfile.h
+++ b/src/util/virfile.h
@@ -302,7 +302,6 @@ char *virFileBuildPath(const char *dir,
 bool virFileIsAbsPath(const char *path);
 int virFileAbsPath(const char *path,
                    char **abspath) G_GNUC_WARN_UNUSED_RESULT;
-const char *virFileSkipRoot(const char *path);
 void virFileRemoveLastComponent(char *path);
 
 int virFileOpenTty(int *ttymaster,
-- 
2.23.0




More information about the libvir-list mailing list