summaryrefslogtreecommitdiff
path: root/glib/src/variant.hg
diff options
context:
space:
mode:
authorDaniel Boles <dboles@src.gnome.org>2017-05-29 23:03:34 +0100
committerDaniel Boles <dboles.src@gmail.com>2017-05-29 23:10:25 +0100
commit79dc3e624426a2ff1bf69c09058cb9927237d617 (patch)
tree691a8c039ef6d9ac56ecd246ddf6b2cbfaa39642 /glib/src/variant.hg
parent5323542bd99fb059f242fb18dce9567678573c59 (diff)
downloadglibmm-79dc3e624426a2ff1bf69c09058cb9927237d617.tar.gz
Variant: Use own get_n_children() instead of C API
This looks much less ugly.
Diffstat (limited to 'glib/src/variant.hg')
-rw-r--r--glib/src/variant.hg6
1 files changed, 2 insertions, 4 deletions
diff --git a/glib/src/variant.hg b/glib/src/variant.hg
index de101954..39c63f1b 100644
--- a/glib/src/variant.hg
+++ b/glib/src/variant.hg
@@ -1125,7 +1125,7 @@ Variant< std::vector<T> >::create(const std::vector<T>& data)
template<class T>
T Variant< std::vector<T> >::get_child(gsize index) const
{
- if(index >= g_variant_n_children(const_cast<GVariant*>(gobj())))
+ if (index >= get_n_children())
throw std::out_of_range(
"Variant< std::vector<T> >::get_child(): Index out of bounds.");
@@ -1143,9 +1143,7 @@ std::vector<T> Variant< std::vector<T> >::get() const
{
std::vector<T> result;
- gsize n_children = g_variant_n_children(const_cast<GVariant*>(gobj()));
-
- for(gsize i = 0; i < n_children; i++)
+ for (gsize i = 0, n_children = get_n_children(); i < n_children; ++i)
{
Glib::Variant<T> variant;