|
|
9ae3a8 |
From beb312b86b7ee776bbaea14d3c7625ec8d2d8402 Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
From: Markus Armbruster <armbru@redhat.com>
|
|
|
9ae3a8 |
Date: Tue, 8 Sep 2015 18:06:19 +0200
|
|
|
9ae3a8 |
Subject: [PATCH 1/7] Drop superfluous conditionals around g_strdup()
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Message-id: <1441735585-23432-2-git-send-email-armbru@redhat.com>
|
|
|
9ae3a8 |
Patchwork-id: 67708
|
|
|
9ae3a8 |
O-Subject: [RHEL-7.2 qemu-kvm PATCH 1/7] Drop superfluous conditionals around g_strdup()
|
|
|
9ae3a8 |
Bugzilla: 1218919
|
|
|
9ae3a8 |
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Fam Zheng <famz@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Markus Armbruster <armbru@redhat.com>
|
|
|
9ae3a8 |
Reviewed-by: Fam Zheng <famz@redhat.com>
|
|
|
9ae3a8 |
Reviewed-by: Eric Blake <eblake@redhat.com>
|
|
|
9ae3a8 |
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
|
|
|
9ae3a8 |
(cherry picked from commit 24588100ab39afead7b9a0e9c61182a02320a1b9)
|
|
|
9ae3a8 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
backends/rng-random.c | 6 +-----
|
|
|
9ae3a8 |
hw/tpm/tpm_passthrough.c | 4 +---
|
|
|
9ae3a8 |
util/uri.c | 43 +++++++++++++++++--------------------------
|
|
|
9ae3a8 |
3 files changed, 19 insertions(+), 34 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/backends/rng-random.c b/backends/rng-random.c
|
|
|
9ae3a8 |
index 68dfc8a..573a64e 100644
|
|
|
9ae3a8 |
--- a/backends/rng-random.c
|
|
|
9ae3a8 |
+++ b/backends/rng-random.c
|
|
|
9ae3a8 |
@@ -88,11 +88,7 @@ static char *rng_random_get_filename(Object *obj, Error **errp)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
RndRandom *s = RNG_RANDOM(obj);
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
- if (s->filename) {
|
|
|
9ae3a8 |
- return g_strdup(s->filename);
|
|
|
9ae3a8 |
- }
|
|
|
9ae3a8 |
-
|
|
|
9ae3a8 |
- return NULL;
|
|
|
9ae3a8 |
+ return g_strdup(s->filename);
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
static void rng_random_set_filename(Object *obj, const char *filename,
|
|
|
9ae3a8 |
diff --git a/hw/tpm/tpm_passthrough.c b/hw/tpm/tpm_passthrough.c
|
|
|
9ae3a8 |
index 56e9e0f..2bf3c6f 100644
|
|
|
9ae3a8 |
--- a/hw/tpm/tpm_passthrough.c
|
|
|
9ae3a8 |
+++ b/hw/tpm/tpm_passthrough.c
|
|
|
9ae3a8 |
@@ -400,9 +400,7 @@ static int tpm_passthrough_handle_device_opts(QemuOpts *opts, TPMBackend *tb)
|
|
|
9ae3a8 |
const char *value;
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
value = qemu_opt_get(opts, "cancel-path");
|
|
|
9ae3a8 |
- if (value) {
|
|
|
9ae3a8 |
- tb->cancel_path = g_strdup(value);
|
|
|
9ae3a8 |
- }
|
|
|
9ae3a8 |
+ tb->cancel_path = g_strdup(value);
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
value = qemu_opt_get(opts, "path");
|
|
|
9ae3a8 |
if (!value) {
|
|
|
9ae3a8 |
diff --git a/util/uri.c b/util/uri.c
|
|
|
9ae3a8 |
index e348c17..bbf2832 100644
|
|
|
9ae3a8 |
--- a/util/uri.c
|
|
|
9ae3a8 |
+++ b/util/uri.c
|
|
|
9ae3a8 |
@@ -1736,24 +1736,21 @@ uri_resolve(const char *uri, const char *base) {
|
|
|
9ae3a8 |
goto done;
|
|
|
9ae3a8 |
if ((ref->scheme == NULL) && (ref->path == NULL) &&
|
|
|
9ae3a8 |
((ref->authority == NULL) && (ref->server == NULL))) {
|
|
|
9ae3a8 |
- if (bas->scheme != NULL)
|
|
|
9ae3a8 |
- res->scheme = g_strdup(bas->scheme);
|
|
|
9ae3a8 |
+ res->scheme = g_strdup(bas->scheme);
|
|
|
9ae3a8 |
if (bas->authority != NULL)
|
|
|
9ae3a8 |
res->authority = g_strdup(bas->authority);
|
|
|
9ae3a8 |
else if (bas->server != NULL) {
|
|
|
9ae3a8 |
- res->server = g_strdup(bas->server);
|
|
|
9ae3a8 |
- if (bas->user != NULL)
|
|
|
9ae3a8 |
- res->user = g_strdup(bas->user);
|
|
|
9ae3a8 |
- res->port = bas->port;
|
|
|
9ae3a8 |
+ res->server = g_strdup(bas->server);
|
|
|
9ae3a8 |
+ res->user = g_strdup(bas->user);
|
|
|
9ae3a8 |
+ res->port = bas->port;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
- if (bas->path != NULL)
|
|
|
9ae3a8 |
- res->path = g_strdup(bas->path);
|
|
|
9ae3a8 |
- if (ref->query != NULL)
|
|
|
9ae3a8 |
+ res->path = g_strdup(bas->path);
|
|
|
9ae3a8 |
+ if (ref->query != NULL) {
|
|
|
9ae3a8 |
res->query = g_strdup (ref->query);
|
|
|
9ae3a8 |
- else if (bas->query != NULL)
|
|
|
9ae3a8 |
- res->query = g_strdup(bas->query);
|
|
|
9ae3a8 |
- if (ref->fragment != NULL)
|
|
|
9ae3a8 |
- res->fragment = g_strdup(ref->fragment);
|
|
|
9ae3a8 |
+ } else {
|
|
|
9ae3a8 |
+ res->query = g_strdup(bas->query);
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
+ res->fragment = g_strdup(ref->fragment);
|
|
|
9ae3a8 |
goto step_7;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
@@ -1767,13 +1764,10 @@ uri_resolve(const char *uri, const char *base) {
|
|
|
9ae3a8 |
val = uri_to_string(ref);
|
|
|
9ae3a8 |
goto done;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
- if (bas->scheme != NULL)
|
|
|
9ae3a8 |
- res->scheme = g_strdup(bas->scheme);
|
|
|
9ae3a8 |
+ res->scheme = g_strdup(bas->scheme);
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
- if (ref->query != NULL)
|
|
|
9ae3a8 |
- res->query = g_strdup(ref->query);
|
|
|
9ae3a8 |
- if (ref->fragment != NULL)
|
|
|
9ae3a8 |
- res->fragment = g_strdup(ref->fragment);
|
|
|
9ae3a8 |
+ res->query = g_strdup(ref->query);
|
|
|
9ae3a8 |
+ res->fragment = g_strdup(ref->fragment);
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
/*
|
|
|
9ae3a8 |
* 4) If the authority component is defined, then the reference is a
|
|
|
9ae3a8 |
@@ -1787,20 +1781,17 @@ uri_resolve(const char *uri, const char *base) {
|
|
|
9ae3a8 |
res->authority = g_strdup(ref->authority);
|
|
|
9ae3a8 |
else {
|
|
|
9ae3a8 |
res->server = g_strdup(ref->server);
|
|
|
9ae3a8 |
- if (ref->user != NULL)
|
|
|
9ae3a8 |
- res->user = g_strdup(ref->user);
|
|
|
9ae3a8 |
+ res->user = g_strdup(ref->user);
|
|
|
9ae3a8 |
res->port = ref->port;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
- if (ref->path != NULL)
|
|
|
9ae3a8 |
- res->path = g_strdup(ref->path);
|
|
|
9ae3a8 |
+ res->path = g_strdup(ref->path);
|
|
|
9ae3a8 |
goto step_7;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
if (bas->authority != NULL)
|
|
|
9ae3a8 |
res->authority = g_strdup(bas->authority);
|
|
|
9ae3a8 |
else if (bas->server != NULL) {
|
|
|
9ae3a8 |
- res->server = g_strdup(bas->server);
|
|
|
9ae3a8 |
- if (bas->user != NULL)
|
|
|
9ae3a8 |
- res->user = g_strdup(bas->user);
|
|
|
9ae3a8 |
+ res->server = g_strdup(bas->server);
|
|
|
9ae3a8 |
+ res->user = g_strdup(bas->user);
|
|
|
9ae3a8 |
res->port = bas->port;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
--
|
|
|
9ae3a8 |
1.8.3.1
|
|
|
9ae3a8 |
|