diff options
author | Marc-André Lureau | 2016-07-26 23:14:56 +0200 |
---|---|---|
committer | Michael S. Tsirkin | 2016-07-28 23:33:46 +0200 |
commit | d9d261142d554504a32d95b771e9d8191631323f (patch) | |
tree | af3592a6cf3138d091bf39febc154581c02855f5 /net/vhost-user.c | |
parent | misc: indentation (diff) | |
download | qemu-d9d261142d554504a32d95b771e9d8191631323f.tar.gz qemu-d9d261142d554504a32d95b771e9d8191631323f.tar.xz qemu-d9d261142d554504a32d95b771e9d8191631323f.zip |
vhost-user: minor simplification
Shorten the code and make it more clear by using the specialized
function g_str_has_prefix().
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'net/vhost-user.c')
-rw-r--r-- | net/vhost-user.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/net/vhost-user.c b/net/vhost-user.c index c4d63e05eb..2af212bddb 100644 --- a/net/vhost-user.c +++ b/net/vhost-user.c @@ -316,7 +316,6 @@ static int net_vhost_check_net(void *opaque, QemuOpts *opts, Error **errp) { const char *name = opaque; const char *driver, *netdev; - const char virtio_name[] = "virtio-net-"; driver = qemu_opt_get(opts, "driver"); netdev = qemu_opt_get(opts, "netdev"); @@ -326,7 +325,7 @@ static int net_vhost_check_net(void *opaque, QemuOpts *opts, Error **errp) } if (strcmp(netdev, name) == 0 && - strncmp(driver, virtio_name, strlen(virtio_name)) != 0) { + !g_str_has_prefix(driver, "virtio-net-")) { error_setg(errp, "vhost-user requires frontend driver virtio-net-*"); return -1; } |