[PATCH 2/3] Simplify bhyveDriverGetCapabilities()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The driver passed as the only argument to the function should never be
NULL so there's no need to check it. After removing it, the whole
function collapses to a single line doing ref over driver
capabilities.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 src/bhyve/bhyve_driver.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c
index 84d1915..6ef9d98 100644
--- a/src/bhyve/bhyve_driver.c
+++ b/src/bhyve/bhyve_driver.c
@@ -2,6 +2,7 @@
  * bhyve_driver.c: core driver methods for managing bhyve guests
  *
  * Copyright (C) 2014 Roman Bogorodskiy
+ * Copyright (C) 2014 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -123,16 +124,10 @@ bhyveAutostartDomains(bhyveConnPtr driver)
  * Returns: a reference to a virCapsPtr instance or NULL
  */
 static virCapsPtr
-bhyveDriverGetCapabilities(bhyveConnPtr driver)
+bhyveDriverGetCapabilities(bhyveConnPtr driver ATTRIBUTE_NONNULL)
 {
-    virCapsPtr ret = NULL;
 
-    if (driver == NULL)
-        return NULL;
-
-    ret = virObjectRef(driver->caps);
-
-    return ret;
+    return virObjectRef(driver->caps);
 }
 
 static char *
-- 
1.9.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]