[virt-tools-list] [libosinfo v3 2/2] install_script: add get_config_param function

Fabiano Fidêncio fabiano at fidencio.org
Sat Oct 6 02:05:00 UTC 2012


Return, if exists, the sought OsinfoInstallConfigParam from an
OsinfoInstallScript. Otherwise, NULL is returned.
---
 osinfo/libosinfo.syms          |  1 +
 osinfo/osinfo_install_script.c | 24 ++++++++++++++++++++++++
 osinfo/osinfo_install_script.h |  2 ++
 3 files changed, 27 insertions(+)

diff --git a/osinfo/libosinfo.syms b/osinfo/libosinfo.syms
index 772e89c..df76108 100644
--- a/osinfo/libosinfo.syms
+++ b/osinfo/libosinfo.syms
@@ -309,6 +309,7 @@ LIBOSINFO_0.2.1 {
 	osinfo_entity_get_param_value_int64_with_default;
 	osinfo_entity_set_param_int64;
 	osinfo_install_script_get_expected_filename;
+	osinfo_install_script_get_config_param;
 } LIBOSINFO_0.2.0;
 
 /* Symbols in next release...
diff --git a/osinfo/osinfo_install_script.c b/osinfo/osinfo_install_script.c
index 8c5d200..cc75153 100644
--- a/osinfo/osinfo_install_script.c
+++ b/osinfo/osinfo_install_script.c
@@ -264,6 +264,30 @@ GList *osinfo_install_script_get_config_param_list(const OsinfoInstallScript *sc
     return g_list_copy(script->priv->config_param_list);
 }
 
+/**
+ * osinfo_install_script_get_config_param:
+ *
+ * Get a config param from the config param's list
+ *
+ * Returns: (transfer full): the sought config param, if exists.
+ *                           NULL otherwise.
+ */
+OsinfoInstallConfigParam *
+osinfo_install_script_get_config_param(const OsinfoInstallScript *script,
+                                       const gchar *name)
+{
+    GList *l;
+
+    for (l = script->priv->config_param_list; l != NULL; l = l->next) {
+        OsinfoInstallConfigParam *tmp = l->data;
+
+        if (g_strcmp0(osinfo_install_config_param_get_name(tmp), name) == 0)
+            return g_object_ref(tmp);
+    }
+
+    return NULL;
+}
+
 static void
 osinfo_install_script_init (OsinfoInstallScript *list)
 {
diff --git a/osinfo/osinfo_install_script.h b/osinfo/osinfo_install_script.h
index 4af62e0..372bacc 100644
--- a/osinfo/osinfo_install_script.h
+++ b/osinfo/osinfo_install_script.h
@@ -137,6 +137,8 @@ gboolean osinfo_install_script_has_config_param(const OsinfoInstallScript *scrip
 
 gboolean osinfo_install_script_has_config_param_name(const OsinfoInstallScript *script, const gchar *name);
 
+OsinfoInstallConfigParam *osinfo_install_script_get_config_param(const OsinfoInstallScript *script, const gchar *name);
+
 void osinfo_install_script_add_config_param(OsinfoInstallScript *script, OsinfoInstallConfigParam *param);
 
 GList *osinfo_install_script_get_config_param_list(const OsinfoInstallScript *script);
-- 
1.7.12.1




More information about the virt-tools-list mailing list