Drop superfluous conditionals around g_strdup()

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
This commit is contained in:
Markus Armbruster 2014-12-04 10:26:55 +01:00 committed by Michael Tokarev
parent 4ad608803c
commit 24588100ab
3 changed files with 19 additions and 34 deletions

View File

@ -88,13 +88,9 @@ static char *rng_random_get_filename(Object *obj, Error **errp)
{
RndRandom *s = RNG_RANDOM(obj);
if (s->filename) {
return g_strdup(s->filename);
}
return NULL;
}
static void rng_random_set_filename(Object *obj, const char *filename,
Error **errp)
{

View File

@ -400,9 +400,7 @@ static int tpm_passthrough_handle_device_opts(QemuOpts *opts, TPMBackend *tb)
const char *value;
value = qemu_opt_get(opts, "cancel-path");
if (value) {
tb->cancel_path = g_strdup(value);
}
value = qemu_opt_get(opts, "path");
if (!value) {

View File

@ -1736,23 +1736,20 @@ uri_resolve(const char *uri, const char *base) {
goto done;
if ((ref->scheme == NULL) && (ref->path == NULL) &&
((ref->authority == NULL) && (ref->server == NULL))) {
if (bas->scheme != NULL)
res->scheme = g_strdup(bas->scheme);
if (bas->authority != NULL)
res->authority = g_strdup(bas->authority);
else if (bas->server != NULL) {
res->server = g_strdup(bas->server);
if (bas->user != NULL)
res->user = g_strdup(bas->user);
res->port = bas->port;
}
if (bas->path != NULL)
res->path = g_strdup(bas->path);
if (ref->query != NULL)
if (ref->query != NULL) {
res->query = g_strdup (ref->query);
else if (bas->query != NULL)
} else {
res->query = g_strdup(bas->query);
if (ref->fragment != NULL)
}
res->fragment = g_strdup(ref->fragment);
goto step_7;
}
@ -1767,12 +1764,9 @@ uri_resolve(const char *uri, const char *base) {
val = uri_to_string(ref);
goto done;
}
if (bas->scheme != NULL)
res->scheme = g_strdup(bas->scheme);
if (ref->query != NULL)
res->query = g_strdup(ref->query);
if (ref->fragment != NULL)
res->fragment = g_strdup(ref->fragment);
/*
@ -1787,11 +1781,9 @@ uri_resolve(const char *uri, const char *base) {
res->authority = g_strdup(ref->authority);
else {
res->server = g_strdup(ref->server);
if (ref->user != NULL)
res->user = g_strdup(ref->user);
res->port = ref->port;
}
if (ref->path != NULL)
res->path = g_strdup(ref->path);
goto step_7;
}
@ -1799,7 +1791,6 @@ uri_resolve(const char *uri, const char *base) {
res->authority = g_strdup(bas->authority);
else if (bas->server != NULL) {
res->server = g_strdup(bas->server);
if (bas->user != NULL)
res->user = g_strdup(bas->user);
res->port = bas->port;
}