[virt-tools-list] [PATCH 09/47] Sanitize naming of filter object APIs

Daniel P. Berrange berrange at redhat.com
Wed Aug 25 19:37:04 UTC 2010


The GObject naming conversion is lowercase, separated
by underscores. This needs to be followed to allow
gobject introspection to be auto-generated easily.

* osinfo/osinfo_filter.c, osinfo/osinfo_filter.h: Convert
  API naming to use lowercase + underscores. Add an
  explicit constructor.
---
 osinfo/osinfo_filter.c |   20 ++++++++------------
 osinfo/osinfo_filter.h |   18 ++++++++----------
 2 files changed, 16 insertions(+), 22 deletions(-)

diff --git a/osinfo/osinfo_filter.c b/osinfo/osinfo_filter.c
index ec4513b..b7f22d0 100644
--- a/osinfo/osinfo_filter.c
+++ b/osinfo/osinfo_filter.c
@@ -47,12 +47,8 @@ osinfo_filter_init (OsinfoFilter *self)
                                                          __osinfoFreePtrArray);
 }
 
-void osinfoFreeFilter(OsinfoFilter *self)
-{
-    g_object_unref(self);
-}
 
-gint osinfoAddFilterConstraint(OsinfoFilter *self, gchar *propName, gchar *propVal, GError **err)
+gint osinfo_filter_add_constraint(OsinfoFilter *self, gchar *propName, gchar *propVal, GError **err)
 {
     if (!__osinfoCheckGErrorParamValid(err))
         return -EINVAL;
@@ -97,7 +93,7 @@ gint osinfoAddFilterConstraint(OsinfoFilter *self, gchar *propName, gchar *propV
 }
 
 // Only applicable to OSes, ignored by other types of objects
-gint osinfoAddRelationConstraint(OsinfoFilter *self, osinfoRelationship relshp, OsinfoOs *os, GError **err)
+gint osinfo_filter_add_relation_constraint(OsinfoFilter *self, osinfoRelationship relshp, OsinfoOs *os, GError **err)
 {
     if (!__osinfoCheckGErrorParamValid(err))
         return -EINVAL;
@@ -143,12 +139,12 @@ error_nomem:
     return -ENOMEM;
 }
 
-void osinfoClearFilterConstraint(OsinfoFilter *self, gchar *propName)
+void osinfo_filter_clear_constraint(OsinfoFilter *self, gchar *propName)
 {
     g_tree_remove(self->priv->propertyConstraints, propName);
 }
 
-void osinfoClearRelationshipConstraint(OsinfoFilter *self, osinfoRelationship relshp)
+void osinfo_filter_clear_relationship_constraint(OsinfoFilter *self, osinfoRelationship relshp)
 {
     g_tree_remove(self->priv->relationshipConstraints, (gpointer) relshp);
 }
@@ -160,14 +156,14 @@ static gboolean __osinfoRemoveTreeEntry(gpointer key, gpointer value, gpointer d
     return FALSE; // continue iterating
 }
 
-void osinfoClearAllFilterConstraints(OsinfoFilter *self)
+void osinfo_filter_clear_all_constraints(OsinfoFilter *self)
 {
     g_tree_foreach(self->priv->propertyConstraints, __osinfoRemoveTreeEntry, self->priv->propertyConstraints);
     g_tree_foreach(self->priv->relationshipConstraints, __osinfoRemoveTreeEntry, self->priv->relationshipConstraints);
 }
 
 // get keyset for constraints map
-GPtrArray *osinfoGetFilterConstraintKeys(OsinfoFilter *self, GError **err)
+GPtrArray *osinfo_filter_get_constraint_keys(OsinfoFilter *self, GError **err)
 {
     if (!__osinfoCheckGErrorParamValid(err))
         return NULL;
@@ -200,7 +196,7 @@ GPtrArray *osinfoGetFilterConstraintKeys(OsinfoFilter *self, GError **err)
 }
 
 // get values for given key
-GPtrArray *osinfoGetFilterConstraintValues(OsinfoFilter *self, gchar *propName, GError **err)
+GPtrArray *osinfo_filter_get_constraint_values(OsinfoFilter *self, gchar *propName, GError **err)
 {
     if (!__osinfoCheckGErrorParamValid(err))
         return NULL;
@@ -245,7 +241,7 @@ GPtrArray *osinfoGetFilterConstraintValues(OsinfoFilter *self, gchar *propName,
 }
 
 // get oses for given relshp
-OsinfoOsList *osinfoGetRelationshipConstraintValue(OsinfoFilter *self, osinfoRelationship relshp, GError **err)
+OsinfoOsList *osinfo_filter_get_relationship_constraint_value(OsinfoFilter *self, osinfoRelationship relshp, GError **err)
 {
     if (!__osinfoCheckGErrorParamValid(err))
         return NULL;
diff --git a/osinfo/osinfo_filter.h b/osinfo/osinfo_filter.h
index e1e4ce8..8116261 100644
--- a/osinfo/osinfo_filter.h
+++ b/osinfo/osinfo_filter.h
@@ -48,19 +48,17 @@ struct _OsinfoFilterClass
 
 GType osinfo_filter_get_type(void);
 
-void osinfoFreeFilter(OsinfoFilter *self);
-
-gint osinfoAddFilterContstraint(OsinfoFilter *self, gchar *propName, gchar *propVal, GError **err);
+gint osinfo_filter_add_constraint(OsinfoFilter *self, gchar *propName, gchar *propVal, GError **err);
 
 // Only applicable to OSes, ignored by other types of objects
-gint osinfoAddRelationConstraint(OsinfoFilter *self, osinfoRelationship relshp, OsinfoOs *os, GError **err);
+gint osinfo_filter_add_relation_constraint(OsinfoFilter *self, osinfoRelationship relshp, OsinfoOs *os, GError **err);
 
-void osinfoClearFilterConstraint(OsinfoFilter *self, gchar *propName);
-void osinfoClearRelationshipConstraint(OsinfoFilter *self, osinfoRelationship relshp);
-void osinfoClearAllFilterConstraints(OsinfoFilter *self);
+void osinfo_filter_clear_constraint(OsinfoFilter *self, gchar *propName);
+void osinfo_filter_clear_relationship_constraint(OsinfoFilter *self, osinfoRelationship relshp);
+void osinfo_filter_clear_all_constraints(OsinfoFilter *self);
 
-GPtrArray *osinfoGetFilterConstraintKeys(OsinfoFilter *self, GError **err);
-gchar *osinfoGetFilterConstraintValue(OsinfoFilter *self, GError **err);
-OsinfoOsList *osinfoGetRelationshipConstraintValue(OsinfoFilter *self, osinfoRelationship relshp, GError **err);
+GPtrArray *osinfo_filter_get_constraint_keys(OsinfoFilter *self, GError **err);
+GPtrArray *osinfo_filter_get_constraint_values(OsinfoFilter *self, gchar *propName, GError **err);
+OsinfoOsList *osinfo_filter_get_relationship_constraint_value(OsinfoFilter *self, osinfoRelationship relshp, GError **err);
 
 #endif /* __OSINFO_FILTER_H__ */
-- 
1.7.2.1




More information about the virt-tools-list mailing list