From ff81f7e0e6f5ee301791909bd7c6563c4a4dab63 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Mon, 7 May 2012 15:01:57 -0300 Subject: [RHEL6 qemu-kvm PATCH 4/6] block: simplify path_is_absolute RH-Author: Paolo Bonzini Message-id: <1336402919-26889-4-git-send-email-pbonzini@redhat.com> Patchwork-id: 39616 O-Subject: [RHEL 6.3 qemu-kvm PATCH 3/5] block: simplify path_is_absolute Bugzilla: 818876 RH-Acked-by: Kevin Wolf RH-Acked-by: Laszlo Ersek RH-Acked-by: Eduardo Habkost Upstream status: to be submitted, in my github blkmirror-job branch On Windows, all the logic is already in is_windows_drive and is_windows_drive_prefix. On POSIX, there is no need to look out for colons. Signed-off-by: Paolo Bonzini --- block.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) Signed-off-by: Eduardo Habkost --- block.c | 15 ++++----------- 1 files changed, 4 insertions(+), 11 deletions(-) diff --git a/block.c b/block.c index 9cef18c..34dec90 100644 --- a/block.c +++ b/block.c @@ -126,21 +126,14 @@ static int path_has_protocol(const char *path) int path_is_absolute(const char *path) { - const char *p; #ifdef _WIN32 /* specific case for names like: "\\.\d:" */ - if (*path == '/' || *path == '\\') + if (is_windows_drive(path) || is_windows_drive_prefix(path)) { return 1; -#endif - p = strchr(path, ':'); - if (p) - p++; - else - p = path; -#ifdef _WIN32 - return (*p == '/' || *p == '\\'); + } + return (*path == '/' || *path == '\\'); #else - return (*p == '/'); + return (*path == '/'); #endif } -- 1.7.3.2