diff mbox

[1/2] clean unnecessary code

Message ID 1368006380-3125-1-git-send-email-trivial@linux.vnet.ibm.com
State New
Headers show

Commit Message

Robert Wang May 8, 2013, 9:46 a.m. UTC
Duplicates a string. If str is NULL it returns NULL, so
can make code simple.

Signed-off-by: Trival <trivial@linux.vnet.ibm.com>
---
 util/uri.c | 2 +-
 vl.c       | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Michael Tokarev May 8, 2013, 12:49 p.m. UTC | #1
08.05.2013 13:46, Trival wrote:
> Duplicates a string. If str is NULL it returns NULL, so
> can make code simple.

Thanks, applied to the trivial queue.  I renamed this patch:
"clean unnecessary code: don't check g_strdup arg for NULL"
to better describe what's going on.

/mjt
diff mbox

Patch

diff --git a/util/uri.c b/util/uri.c
index 4238729..e348c17 100644
--- a/util/uri.c
+++ b/util/uri.c
@@ -2162,7 +2162,7 @@  query_params_append (struct QueryParams *ps,
     }
 
     ps->p[ps->n].name = g_strdup(name);
-    ps->p[ps->n].value = value ? g_strdup(value) : NULL;
+    ps->p[ps->n].value = g_strdup(value);
     ps->p[ps->n].ignore = 0;
     ps->n++;
 
diff --git a/vl.c b/vl.c
index 6e6225f..be0a93c 100644
--- a/vl.c
+++ b/vl.c
@@ -1215,7 +1215,7 @@  void add_boot_device_path(int32_t bootindex, DeviceState *dev,
 
     node = g_malloc0(sizeof(FWBootEntry));
     node->bootindex = bootindex;
-    node->suffix = suffix ? g_strdup(suffix) : NULL;
+    node->suffix = g_strdup(suffix);
     node->dev = dev;
 
     QTAILQ_FOREACH(i, &fw_boot_order, link) {