[Libosinfo] [libosinfo PATCH v2 08/15] os: Add osinfo_os_get_devices_internal()

Fabiano Fidêncio fidencio at redhat.com
Mon Nov 12 10:30:55 UTC 2018


The addition of this new function is basically preparing the ground for
the changes that are coming in the next commits where
osinfo_os_get_devices() will have to deal with "removed" devices.

https://gitlab.com/libosinfo/osinfo-db/issues/13

Signed-off-by: Fabiano Fidêncio <fidencio at redhat.com>
---
 osinfo/osinfo_os.c | 29 +++++++++++++++++++----------
 1 file changed, 19 insertions(+), 10 deletions(-)

diff --git a/osinfo/osinfo_os.c b/osinfo/osinfo_os.c
index ec1d679..42fa2d8 100644
--- a/osinfo/osinfo_os.c
+++ b/osinfo/osinfo_os.c
@@ -204,16 +204,10 @@ OsinfoOs *osinfo_os_new(const gchar *id)
 }
 
 
-/**
- * osinfo_os_get_devices:
- * @os: an operating system
- * @filter: (allow-none)(transfer none): an optional device property filter
- *
- * Get all devices matching a given filter
- *
- * Returns: (transfer full): A list of devices
- */
-OsinfoDeviceList *osinfo_os_get_devices(OsinfoOs *os, OsinfoFilter *filter)
+static OsinfoDeviceList *
+osinfo_os_get_devices_internal(OsinfoOs *os,
+                               OsinfoFilter *filter,
+                               gboolean include_removed)
 {
     g_return_val_if_fail(OSINFO_IS_OS(os), NULL);
     g_return_val_if_fail(!filter || OSINFO_IS_FILTER(filter), NULL);
@@ -235,6 +229,21 @@ OsinfoDeviceList *osinfo_os_get_devices(OsinfoOs *os, OsinfoFilter *filter)
     return newList;
 }
 
+
+/**
+ * osinfo_os_get_devices:
+ * @os: an operating system
+ * @filter: (allow-none)(transfer none): an optional device property filter
+ *
+ * Get all devices matching a given filter
+ *
+ * Returns: (transfer full): A list of devices
+ */
+OsinfoDeviceList *osinfo_os_get_devices(OsinfoOs *os, OsinfoFilter *filter)
+{
+    return osinfo_os_get_devices_internal(os, filter, FALSE);
+}
+
 struct GetAllDevicesData {
     OsinfoFilter *filter;
     OsinfoDeviceList *devices;
-- 
2.19.1




More information about the Libosinfo mailing list