summaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorMarkus Armbruster2013-01-22 11:07:57 +0100
committerStefan Hajnoczi2013-01-30 11:14:46 +0100
commitc64f50d1e250879611e6f328e2c4fb18c8a4ab0c (patch)
tree93e1a5b9279becfec8eba4477924cfa67a1f89b0 /util
parentg_malloc(0) and g_malloc0(0) return NULL; simplify (diff)
downloadqemu-c64f50d1e250879611e6f328e2c4fb18c8a4ab0c.tar.gz
qemu-c64f50d1e250879611e6f328e2c4fb18c8a4ab0c.tar.xz
qemu-c64f50d1e250879611e6f328e2c4fb18c8a4ab0c.zip
g_strdup(NULL) returns NULL; simplify
Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'util')
-rw-r--r--util/qemu-option.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/util/qemu-option.c b/util/qemu-option.c
index f532b765a0..c12e7245ef 100644
--- a/util/qemu-option.c
+++ b/util/qemu-option.c
@@ -643,9 +643,7 @@ static void opt_set(QemuOpts *opts, const char *name, const char *value,
QTAILQ_INSERT_TAIL(&opts->head, opt, next);
}
opt->desc = desc;
- if (value) {
- opt->str = g_strdup(value);
- }
+ opt->str = g_strdup(value);
qemu_opt_parse(opt, &local_err);
if (error_is_set(&local_err)) {
error_propagate(errp, local_err);
@@ -792,9 +790,7 @@ QemuOpts *qemu_opts_create(QemuOptsList *list, const char *id,
}
}
opts = g_malloc0(sizeof(*opts));
- if (id) {
- opts->id = g_strdup(id);
- }
+ opts->id = g_strdup(id);
opts->list = list;
loc_save(&opts->loc);
QTAILQ_INIT(&opts->head);