[libvirt] [PATCH 0/2] Remove VIR_FILE_*_SEPARATOR_*

Let's use the defines provided by GLib, instead of keeping our own. Fabiano Fidêncio (2): util: Use G_DIR_SEPARATOR instead of VIR_FILE_DIR_SEPARATOR util: Remove VIR_FILE_*_SEPARATOR* src/util/virfile.c | 2 +- src/util/virfile.h | 19 ------------------- 2 files changed, 1 insertion(+), 20 deletions(-) -- 2.23.0

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com> --- src/util/virfile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/virfile.c b/src/util/virfile.c index b72d18b3d2..0f0d607c59 100644 --- a/src/util/virfile.c +++ b/src/util/virfile.c @@ -3278,7 +3278,7 @@ virFileRemoveLastComponent(char *path) { char *tmp; - if ((tmp = strrchr(path, VIR_FILE_DIR_SEPARATOR))) + if ((tmp = strrchr(path, G_DIR_SEPARATOR))) tmp[1] = '\0'; else path[0] = '\0'; -- 2.23.0

None of those are used and we should prefer using the ones provided by GLib, as G_DIR_SEPARATOR, G_DIR_SEPARATOR_S, G_SEARCHPATH_SEPARATOR, and G_SEARCHPATH_SEPARATOR_S. Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com> --- src/util/virfile.h | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/src/util/virfile.h b/src/util/virfile.h index 3fd1795813..264b12c03d 100644 --- a/src/util/virfile.h +++ b/src/util/virfile.h @@ -278,25 +278,6 @@ char *virFileBuildPath(const char *dir, const char *ext) G_GNUC_WARN_UNUSED_RESULT; -#ifdef WIN32 -/* On Win32, the canonical directory separator is the backslash, and - * the search path separator is the semicolon. Note that also the - * (forward) slash works as directory separator. - */ -# define VIR_FILE_DIR_SEPARATOR '\\' -# define VIR_FILE_DIR_SEPARATOR_S "\\" -# define VIR_FILE_PATH_SEPARATOR ';' -# define VIR_FILE_PATH_SEPARATOR_S ";" - -#else /* !WIN32 */ - -# define VIR_FILE_DIR_SEPARATOR '/' -# define VIR_FILE_DIR_SEPARATOR_S "/" -# define VIR_FILE_PATH_SEPARATOR ':' -# define VIR_FILE_PATH_SEPARATOR_S ":" - -#endif /* !WIN32 */ - int virFileAbsPath(const char *path, char **abspath) G_GNUC_WARN_UNUSED_RESULT; void virFileRemoveLastComponent(char *path); -- 2.23.0

On 12/18/19 3:17 PM, Fabiano Fidêncio wrote:
Let's use the defines provided by GLib, instead of keeping our own.
Fabiano Fidêncio (2): util: Use G_DIR_SEPARATOR instead of VIR_FILE_DIR_SEPARATOR util: Remove VIR_FILE_*_SEPARATOR*
src/util/virfile.c | 2 +- src/util/virfile.h | 19 ------------------- 2 files changed, 1 insertion(+), 20 deletions(-)
I'm guessing this series is based on your previous virFile removals. An independent series should be based on master, otherwise 'git am' gets confused about missing ancestors which makes it harder to test+review. I applied manually though, so: Reviewed-by: Cole Robinson <crobinso@redhat.com> Possible follow up: virFileRemoveLastComponent only has one user, and it may be pretty close to g_path_get_dirname(), so that can possibly be dropped. Might want to check the glib implementation though - Cole
participants (2)
-
Cole Robinson
-
Fabiano Fidêncio