summaryrefslogtreecommitdiff
path: root/govirt/ovirt-utils.h
diff options
context:
space:
mode:
authorIordan Iordanov <iiordanov@gmail.com>2013-12-09 12:23:43 -0500
committerChristophe Fergeau <cfergeau@redhat.com>2013-12-11 15:46:36 +0100
commita3002a648c5189fb535ee836eb7ba7c96fef2040 (patch)
tree4a38308d42f1a448a5d37548b6c21d33da8a5ee1 /govirt/ovirt-utils.h
parentdbc512c766829089888cd54780fb0ce646f903be (diff)
Reduced code duplication in OvirtVmPool by adding a utility function.
The functions to get size, prestarted_vms, and user_max_vms were all almost the same code because each one was getting an integer from an XML node. To deal with the code duplication, a utility function was added which given a g_object and an XML node, sets a specified g_object property from a specified XML sub-node. This patch removes the separate functions and replaces them with calls to the new utility function, called g_object_set_guint_property_from_xml().
Diffstat (limited to 'govirt/ovirt-utils.h')
-rw-r--r--govirt/ovirt-utils.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/govirt/ovirt-utils.h b/govirt/ovirt-utils.h
index f627c13..e92a2ec 100644
--- a/govirt/ovirt-utils.h
+++ b/govirt/ovirt-utils.h
@@ -32,6 +32,10 @@ G_BEGIN_DECLS
RestXmlNode *ovirt_rest_xml_node_from_call(RestProxyCall *call);
const char *ovirt_rest_xml_node_get_content(RestXmlNode *node, ...);
gboolean ovirt_utils_gerror_from_xml_fault(RestXmlNode *root, GError **error);
+gboolean g_object_set_guint_property_from_xml(GObject *g_object,
+ RestXmlNode *node,
+ const gchar *node_name,
+ const gchar *prop_name);
const char *ovirt_utils_genum_get_nick (GType enum_type, gint value);
int ovirt_utils_genum_get_value (GType enum_type, const char *nick,