diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2018-02-19 18:27:15 +0100 |
---|---|---|
committer | Greg Kurz <groug@kaod.org> | 2018-02-19 18:27:15 +0100 |
commit | e446a1eb5e358e47193a03a7a5f3ce9b8b5e36ea (patch) | |
tree | 385e9d5d7d2658d3489719669aa5c4b6e6137f08 /hw/9pfs/9p.c | |
parent | 299a2e6fac397be9b82c66583d53d1daaa3ffe6c (diff) | |
download | qemu-e446a1eb5e358e47193a03a7a5f3ce9b8b5e36ea.zip qemu-e446a1eb5e358e47193a03a7a5f3ce9b8b5e36ea.tar.gz qemu-e446a1eb5e358e47193a03a7a5f3ce9b8b5e36ea.tar.bz2 |
9p: v9fs_path_copy() readability
lhs/rhs doesn't tell much about how argument are handled, dst/src is
and const arguments is clearer in my mind. Use g_memdup() while at it.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Greg Kurz <groug@kaod.org>
Diffstat (limited to 'hw/9pfs/9p.c')
-rw-r--r-- | hw/9pfs/9p.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c index 85a1ed8..48fa48e 100644 --- a/hw/9pfs/9p.c +++ b/hw/9pfs/9p.c @@ -190,12 +190,11 @@ v9fs_path_sprintf(V9fsPath *path, const char *fmt, ...) va_end(ap); } -void v9fs_path_copy(V9fsPath *lhs, V9fsPath *rhs) +void v9fs_path_copy(V9fsPath *dst, const V9fsPath *src) { - v9fs_path_free(lhs); - lhs->data = g_malloc(rhs->size); - memcpy(lhs->data, rhs->data, rhs->size); - lhs->size = rhs->size; + v9fs_path_free(dst); + dst->size = src->size; + dst->data = g_memdup(src->data, src->size); } int v9fs_name_to_path(V9fsState *s, V9fsPath *dirpath, |