[Telepathy-commits] [telepathy-glib/master] Add tp_intset_new_singleton.

Will Thompson will.thompson at collabora.co.uk
Tue Feb 3 10:53:38 PST 2009


Fixes fd.o #19907
---
 docs/reference/telepathy-glib-sections.txt |    1 +
 telepathy-glib/intset.c                    |   21 +++++++++++++++++++++
 telepathy-glib/intset.h                    |    1 +
 3 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/docs/reference/telepathy-glib-sections.txt b/docs/reference/telepathy-glib-sections.txt
index 792e209..09cbbb5 100644
--- a/docs/reference/telepathy-glib-sections.txt
+++ b/docs/reference/telepathy-glib-sections.txt
@@ -1389,6 +1389,7 @@ TpIntSet
 TpIntFunc
 tp_intset_sized_new
 tp_intset_new
+tp_intset_new_singleton
 tp_intset_destroy
 tp_intset_clear
 tp_intset_add
diff --git a/telepathy-glib/intset.c b/telepathy-glib/intset.c
index a0fb8b9..b1612af 100644
--- a/telepathy-glib/intset.c
+++ b/telepathy-glib/intset.c
@@ -94,6 +94,27 @@ tp_intset_new ()
 }
 
 /**
+ * tp_intset_new_singleton:
+ * @element: integer to add to a new set
+ *
+ * Allocate a new integer set containing the given integer.
+ *
+ * Returns: a new integer set containing @element, to be destroyed with
+ * tp_intset_destroy()
+ *
+ * @since 0.7.UNRELEASED
+ */
+TpIntSet *
+tp_intset_new_singleton (guint element)
+{
+  TpIntSet *ret = tp_intset_sized_new (element + 1);
+
+  tp_intset_add (ret, element);
+
+  return ret;
+}
+
+/**
  * tp_intset_destroy:
  * @set: set
  *
diff --git a/telepathy-glib/intset.h b/telepathy-glib/intset.h
index 85a1f7b..7d867b7 100644
--- a/telepathy-glib/intset.h
+++ b/telepathy-glib/intset.h
@@ -45,6 +45,7 @@ typedef void (*TpIntFunc) (guint i, gpointer userdata);
 
 TpIntSet *tp_intset_new (void);
 TpIntSet *tp_intset_sized_new (guint size);
+TpIntSet *tp_intset_new_singleton (guint element);
 void tp_intset_destroy (TpIntSet *set);
 void tp_intset_clear (TpIntSet *set);
 
-- 
1.5.6.5




More information about the telepathy-commits mailing list