[glibmm] Glib::Variant—Cosmetically tweak braces & newlines



commit d99789591b0d6b413150313ab9dbbb5442d1f78a
Author: Daniel Boles <dboles src gnome org>
Date:   Sun Feb 5 23:50:25 2017 +0000

    Glib::Variant—Cosmetically tweak braces & newlines
    
    Donʼt use braces for single-line blocks, and do if the other side of an
    if/else already did. Also, get rid of a couple of extraneous newlines.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=778219

 glib/src/variant.ccg |   20 ++++----------------
 1 files changed, 4 insertions(+), 16 deletions(-)
---
diff --git a/glib/src/variant.ccg b/glib/src/variant.ccg
index 89e557d..2418798 100644
--- a/glib/src/variant.ccg
+++ b/glib/src/variant.ccg
@@ -28,13 +28,10 @@ VariantBase::VariantBase(GVariant* castitem, bool make_a_copy /* = false */)
   if (castitem)
   {
     if (g_variant_is_floating(castitem))
-    {
       g_variant_ref_sink(castitem);
-    }
+
     if (make_a_copy)
-    {
       g_variant_ref(castitem);
-    }
   }
 
   gobject_ = castitem;
@@ -158,9 +155,7 @@ VariantContainerBase::create_tuple(const std::vector<VariantBase>& children)
   var_ptr* const var_array = new var_ptr[children.size()];
 
   for (std::vector<VariantBase>::size_type i = 0; i < children.size(); i++)
-  {
     var_array[i] = const_cast<GVariant*>(children[i].gobj());
-  }
 
   VariantContainerBase result =
     VariantContainerBase(g_variant_new_tuple(var_array, children.size()));
@@ -202,9 +197,8 @@ VariantContainerBase
 VariantBase::cast_dynamic<VariantContainerBase>(const VariantBase& v) throw(std::bad_cast)
 {
   if (!v.gobj())
-  {
     return VariantContainerBase();
-  }
+
   if (v.get_type().is_container())
   {
     return VariantContainerBase(const_cast<GVariant*>(v.gobj()), true);
@@ -227,7 +221,9 @@ VariantContainerBase::get_maybe(VariantBase& maybe) const
     return true;
   }
   else
+  {
     return false;
+  }
 }
 
 VariantIter
@@ -401,9 +397,7 @@ Variant<type_vec_ustring>::create(const type_vec_ustring& data)
 
   // Add the elements of the vector into the builder.
   for (const auto& str : data)
-  {
     g_variant_builder_add(builder, element_variant_type.get_string().c_str(), str.c_str());
-  }
 
   // Create the variant using the builder.
   auto result =
@@ -438,7 +432,6 @@ Variant<type_vec_ustring>::get() const
   for (gsize i = 0; i < n_children; i++)
   {
     GVariant* gvariant = g_variant_get_child_value(const_cast<GVariant*>(gobj()), i);
-
     result.emplace_back(Glib::Variant<Glib::ustring>(gvariant).get());
   }
 
@@ -479,9 +472,7 @@ Variant<type_vec_string>::create(const type_vec_string& data)
 
   // Add the elements of the vector into the string array.
   for (type_vec_string::size_type i = 0; i < data.size(); i++)
-  {
     str_array[i] = g_strdup(data[i].c_str());
-  }
 
   // Terminate the string array.
   str_array[data.size()] = nullptr;
@@ -502,9 +493,7 @@ Variant<type_vec_string>::create_from_object_paths(const type_vec_string& data)
 
   // Add the elements of the vector into the string array.
   for (type_vec_string::size_type i = 0; i < data.size(); i++)
-  {
     str_array[i] = g_strdup(data[i].c_str());
-  }
 
   // Terminate the string array.
   str_array[data.size()] = nullptr;
@@ -542,7 +531,6 @@ Variant<type_vec_string>::get() const
   for (gsize i = 0; i < n_children; i++)
   {
     GVariant* gvariant = g_variant_get_child_value(const_cast<GVariant*>(gobj()), i);
-
     result.emplace_back(Glib::Variant<std::string>(gvariant).get());
   }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]