[Libosinfo] [libosinfo PATCH 3/3] db: deprecate osinfo_db_guess_os_from_tree()

Fabiano Fidêncio fidencio at redhat.com
Wed Jun 26 09:16:10 UTC 2019


Let's deprecate osinfo_db_guess_os_from_tree() and "force" the apps to
use the new/simpler API.

Signed-off-by: Fabiano Fidêncio <fidencio at redhat.com>
---
 osinfo/osinfo_db.c | 41 +++++++++++++++++++++++++----------------
 osinfo/osinfo_db.h |  1 +
 2 files changed, 26 insertions(+), 16 deletions(-)

diff --git a/osinfo/osinfo_db.c b/osinfo/osinfo_db.c
index 0a22c07..a5369f2 100644
--- a/osinfo/osinfo_db.c
+++ b/osinfo/osinfo_db.c
@@ -840,20 +840,10 @@ static gboolean compare_tree(OsinfoTree *tree,
     return FALSE;
 }
 
-/**
- * osinfo_db_guess_os_from_tree:
- * @db: the database
- * @tree: the installation tree
- * @matched_tree: (out) (transfer none) (allow-none): the matched operating
- * system tree
- *
- * Guess operating system given an #OsinfoTree object.
- *
- * Returns: (transfer none): the operating system, or NULL if guessing failed
- */
-OsinfoOs *osinfo_db_guess_os_from_tree(OsinfoDb *db,
-                                       OsinfoTree *tree,
-                                       OsinfoTree **matched_tree)
+static OsinfoOs *
+osinfo_db_guess_os_from_tree_internal(OsinfoDb *db,
+                                      OsinfoTree *tree,
+                                      OsinfoTree **matched_tree)
 {
     OsinfoOs *ret = NULL;
     GList *oss = NULL;
@@ -875,6 +865,25 @@ OsinfoOs *osinfo_db_guess_os_from_tree(OsinfoDb *db,
     return ret;
 }
 
+/**
+ * osinfo_db_guess_os_from_tree:
+ * @db: the database
+ * @tree: the installation tree
+ * @matched_tree: (out) (transfer none) (allow-none): the matched operating
+ * system tree
+ *
+ * Guess operating system given an #OsinfoTree object.
+ *
+ * Returns: (transfer none): the operating system, or NULL if guessing failed
+ * Deprecated: 1.6.0: Use osinfo_db_identify_tree() instead.
+ */
+OsinfoOs *osinfo_db_guess_os_from_tree(OsinfoDb *db,
+                                       OsinfoTree *tree,
+                                       OsinfoTree **matched_tree)
+{
+    return osinfo_db_guess_os_from_tree_internal(db, tree, matched_tree);
+}
+
 static void fill_tree(OsinfoDb *db, OsinfoTree *tree,
                       OsinfoTree *matched_tree,
                       OsinfoOs *os)
@@ -969,8 +978,8 @@ gboolean osinfo_db_identify_tree(OsinfoDb *db,
     g_return_val_if_fail(OSINFO_IS_MEDIA(tree), FALSE);
     g_return_val_if_fail(OSINFO_IS_DB(db), FALSE);
 
-    matched_os = osinfo_db_guess_os_from_tree(db, tree,
-                                              &matched_tree);
+    matched_os = osinfo_db_guess_os_from_tree_internal(db, tree,
+                                                       &matched_tree);
     if (matched_os == NULL) {
         return FALSE;
     }
diff --git a/osinfo/osinfo_db.h b/osinfo/osinfo_db.h
index 7702739..a35f9b4 100644
--- a/osinfo/osinfo_db.h
+++ b/osinfo/osinfo_db.h
@@ -107,6 +107,7 @@ OsinfoOs *osinfo_db_guess_os_from_media(OsinfoDb *db,
 gboolean osinfo_db_identify_media(OsinfoDb *db,
                                   OsinfoMedia *media);
 
+G_DEPRECATED_FOR(osinfo_db_identify_tree)
 OsinfoOs *osinfo_db_guess_os_from_tree(OsinfoDb *db,
                                        OsinfoTree *tree,
                                        OsinfoTree **matched_tree);
-- 
2.21.0




More information about the Libosinfo mailing list