[libvirt] [PATCH 0/3] Remove unused virFile*() functions

- virFileSkipRoot() is no longer used since faf2d811f3e9a4; - virFileIsAbsPath() is no longer used since faf2d811f3e9a4; - VIR_FILE_IS_DIR_SEPARATOR is no longer used since virFileIsAbsPath has been dropped; Fabiano Fidêncio (3): util: Remove virFileSkipRoot() util: Remove virFileIsAbsPath() util: Remove VIR_FILE_IS_DIR_SEPARATOR src/libvirt_private.syms | 2 -- src/util/virfile.c | 73 ---------------------------------------- src/util/virfile.h | 4 --- 3 files changed, 79 deletions(-) -- 2.23.0

The function is no longer used since commit faf2d811f3e9a4. Signed-off-by: Fabiano Fidêncio <fidencio@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

The function is no longer used since commit faf2d811f3e9a4. Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com> --- src/libvirt_private.syms | 1 - src/util/virfile.c | 19 ------------------- src/util/virfile.h | 1 - 3 files changed, 21 deletions(-) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 797c15bb42..a7b1ef23bc 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -1994,7 +1994,6 @@ virFileGetMountSubtree; virFileGetXAttr; virFileGetXAttrQuiet; virFileInData; -virFileIsAbsPath; virFileIsCDROM; virFileIsDir; virFileIsExecutable; diff --git a/src/util/virfile.c b/src/util/virfile.c index 624bd9e3d0..b72d18b3d2 100644 --- a/src/util/virfile.c +++ b/src/util/virfile.c @@ -3178,25 +3178,6 @@ virFileOpenTty(int *ttymaster G_GNUC_UNUSED, } #endif /* WIN32 */ -bool -virFileIsAbsPath(const char *path) -{ - if (!path) - return false; - - if (VIR_FILE_IS_DIR_SEPARATOR(path[0])) - return true; - -#ifdef WIN32 - if (g_ascii_isalpha(path[0]) && - path[1] == ':' && - VIR_FILE_IS_DIR_SEPARATOR(path[2])) - return true; -#endif - - return false; -} - /* * 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 80641f763a..550d06ce94 100644 --- a/src/util/virfile.h +++ b/src/util/virfile.h @@ -299,7 +299,6 @@ char *virFileBuildPath(const char *dir, #endif /* !WIN32 */ -bool virFileIsAbsPath(const char *path); int virFileAbsPath(const char *path, char **abspath) G_GNUC_WARN_UNUSED_RESULT; void virFileRemoveLastComponent(char *path); -- 2.23.0

The define is not used since virFileIsAbsPath() has been dropped. Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com> --- src/util/virfile.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/util/virfile.h b/src/util/virfile.h index 550d06ce94..3fd1795813 100644 --- a/src/util/virfile.h +++ b/src/util/virfile.h @@ -285,7 +285,6 @@ char *virFileBuildPath(const char *dir, */ # define VIR_FILE_DIR_SEPARATOR '\\' # define VIR_FILE_DIR_SEPARATOR_S "\\" -# define VIR_FILE_IS_DIR_SEPARATOR(c) ((c) == VIR_FILE_DIR_SEPARATOR || (c) == '/') # define VIR_FILE_PATH_SEPARATOR ';' # define VIR_FILE_PATH_SEPARATOR_S ";" @@ -293,7 +292,6 @@ char *virFileBuildPath(const char *dir, # define VIR_FILE_DIR_SEPARATOR '/' # define VIR_FILE_DIR_SEPARATOR_S "/" -# define VIR_FILE_IS_DIR_SEPARATOR(c) ((c) == VIR_FILE_DIR_SEPARATOR) # define VIR_FILE_PATH_SEPARATOR ':' # define VIR_FILE_PATH_SEPARATOR_S ":" -- 2.23.0

On 12/18/19 4:59 PM, Fabiano Fidêncio wrote:
- virFileSkipRoot() is no longer used since faf2d811f3e9a4; - virFileIsAbsPath() is no longer used since faf2d811f3e9a4; - VIR_FILE_IS_DIR_SEPARATOR is no longer used since virFileIsAbsPath has been dropped;
Fabiano Fidêncio (3): util: Remove virFileSkipRoot() util: Remove virFileIsAbsPath() util: Remove VIR_FILE_IS_DIR_SEPARATOR
src/libvirt_private.syms | 2 -- src/util/virfile.c | 73 ---------------------------------------- src/util/virfile.h | 4 --- 3 files changed, 79 deletions(-)
All patches: Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>

On 12/18/19 2:59 PM, Fabiano Fidêncio wrote:
- virFileSkipRoot() is no longer used since faf2d811f3e9a4; - virFileIsAbsPath() is no longer used since faf2d811f3e9a4; - VIR_FILE_IS_DIR_SEPARATOR is no longer used since virFileIsAbsPath has been dropped;
Fabiano Fidêncio (3): util: Remove virFileSkipRoot() util: Remove virFileIsAbsPath() util: Remove VIR_FILE_IS_DIR_SEPARATOR
src/libvirt_private.syms | 2 -- src/util/virfile.c | 73 ---------------------------------------- src/util/virfile.h | 4 --- 3 files changed, 79 deletions(-)
Reviewed-by: Cole Robinson <crobinso@redhat.com> - Cole
participants (3)
-
Cole Robinson
-
Daniel Henrique Barboza
-
Fabiano Fidêncio