On 01/26/2016 03:38 AM, Fam Zheng wrote:
> With the return value decoupled from VMDK, it can be reused by other block
> code.
> 
> Signed-off-by: Fam Zheng <f...@redhat.com>
> ---
>  block.c               | 40 ++++++++++++++++++++++++++++++++++++++++
>  block/vmdk.c          | 40 ----------------------------------------
>  include/block/block.h |  2 ++
>  3 files changed, 42 insertions(+), 40 deletions(-)
> 

> +++ b/block.c
> @@ -144,6 +144,46 @@ int path_is_absolute(const char *path)
>  #endif
>  }
>  
> +int filename_decompose(const char *filename, char *path, char *prefix,
> +                       char *postfix, size_t buf_len, Error **errp)
> +{
> +    const char *p, *q;
> +
> +    if (filename == NULL || !strlen(filename)) {
> +        error_setg(errp, "No filename provided");
> +        return -EINVAL;
> +    }
> +    p = strrchr(filename, '/');
> +    if (p == NULL) {
> +        p = strrchr(filename, '\\');
> +    }

I know this is just code motion, but it feels like it does the wrong
thing on Unix boxes (trying too hard to appease Windows boxes).  Is that
something that needs to be independently addressed?

But as for this patch, the code motion is fine.
Reviewed-by: Eric Blake <ebl...@redhat.com>

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to