[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 3/3] opts: remove redundant check for NULL parameter
From: |
Daniel P . Berrangé |
Subject: |
[Qemu-devel] [PATCH 3/3] opts: remove redundant check for NULL parameter |
Date: |
Mon, 14 May 2018 18:19:13 +0100 |
No callers of get_opt_value() pass in a NULL for the "value" parameter,
so the check is redundant.
Signed-off-by: Daniel P. Berrangé <address@hidden>
---
util/qemu-option.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/util/qemu-option.c b/util/qemu-option.c
index 8a68bc2314..a1ff682aac 100644
--- a/util/qemu-option.c
+++ b/util/qemu-option.c
@@ -75,9 +75,7 @@ const char *get_opt_value(const char *p, char **value)
size_t capacity = 0, length;
const char *offset;
- if (value) {
- *value = NULL;
- }
+ *value = NULL;
while (1) {
offset = strchr(p, ',');
if (!offset) {
@@ -88,11 +86,9 @@ const char *get_opt_value(const char *p, char **value)
if (*offset != '\0' && *(offset + 1) == ',') {
length++;
}
- if (value) {
- *value = g_renew(char, *value, capacity + length + 1);
- strncpy(*value + capacity, p, length);
- (*value)[capacity + length] = '\0';
- }
+ *value = g_renew(char, *value, capacity + length + 1);
+ strncpy(*value + capacity, p, length);
+ (*value)[capacity + length] = '\0';
capacity += length;
if (*offset == '\0' ||
*(offset + 1) != ',') {
--
2.17.0