[gnome-builder] xml-pack: code style cleanup



commit c6578f056deb569ce94c41d3c3cfa626b40106a6
Author: Christian Hergert <chergert redhat com>
Date:   Fri Jan 12 19:09:54 2018 -0800

    xml-pack: code style cleanup

 src/plugins/xml-pack/ide-xml-parser.c             |  6 ++----
 src/plugins/xml-pack/ide-xml-schema-cache-entry.c | 18 ++++++++++++------
 2 files changed, 14 insertions(+), 10 deletions(-)
---
diff --git a/src/plugins/xml-pack/ide-xml-parser.c b/src/plugins/xml-pack/ide-xml-parser.c
index 11fe16a60..f030c645f 100644
--- a/src/plugins/xml-pack/ide-xml-parser.c
+++ b/src/plugins/xml-pack/ide-xml-parser.c
@@ -643,12 +643,10 @@ ide_xml_parser_get_analysis_finish (IdeXmlParser  *self,
                                     GAsyncResult  *result,
                                     GError       **error)
 {
-  GTask *task = (GTask *)result;
-
   g_return_val_if_fail (IDE_IS_XML_PARSER (self), NULL);
-  g_return_val_if_fail (G_IS_TASK (task), NULL);
+  g_return_val_if_fail (G_IS_TASK (result), NULL);
 
-  return g_task_propagate_pointer (task, error);
+  return g_task_propagate_pointer (G_TASK (result), error);
 }
 
 gchar *
diff --git a/src/plugins/xml-pack/ide-xml-schema-cache-entry.c 
b/src/plugins/xml-pack/ide-xml-schema-cache-entry.c
index d8a6e1f76..14a1a1e37 100644
--- a/src/plugins/xml-pack/ide-xml-schema-cache-entry.c
+++ b/src/plugins/xml-pack/ide-xml-schema-cache-entry.c
@@ -16,9 +16,14 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#define G_LOG_DOMAIN "ide-xml-schema-cache-entry"
+
 #include "ide-xml-schema-cache-entry.h"
 
-G_DEFINE_BOXED_TYPE (IdeXmlSchemaCacheEntry, ide_xml_schema_cache_entry, ide_xml_schema_cache_entry_ref, 
ide_xml_schema_cache_entry_unref)
+G_DEFINE_BOXED_TYPE (IdeXmlSchemaCacheEntry,
+                     ide_xml_schema_cache_entry,
+                     ide_xml_schema_cache_entry_ref,
+                     ide_xml_schema_cache_entry_unref)
 
 IdeXmlSchemaCacheEntry *
 ide_xml_schema_cache_entry_new (void)
@@ -60,6 +65,7 @@ ide_xml_schema_cache_entry_copy (IdeXmlSchemaCacheEntry *self)
   g_return_val_if_fail (self->ref_count, NULL);
 
   copy = ide_xml_schema_cache_entry_new ();
+
   if (self->content != NULL)
     copy->content = g_bytes_ref (self->content);
 
@@ -81,8 +87,8 @@ ide_xml_schema_cache_entry_copy (IdeXmlSchemaCacheEntry *self)
 static void
 ide_xml_schema_cache_entry_free (IdeXmlSchemaCacheEntry *self)
 {
-  g_assert (self);
-  g_assert_cmpint (self->ref_count, ==, 0);
+  g_assert (self != NULL);
+  g_assert (self->ref_count == 0);
 
   g_clear_pointer (&self->content, g_bytes_unref);
   g_clear_object (&self->file);
@@ -95,7 +101,7 @@ IdeXmlSchemaCacheEntry *
 ide_xml_schema_cache_entry_ref (IdeXmlSchemaCacheEntry *self)
 {
   g_return_val_if_fail (self, NULL);
-  g_return_val_if_fail (self->ref_count, NULL);
+  g_return_val_if_fail (self->ref_count > 0, NULL);
 
   g_atomic_int_inc (&self->ref_count);
 
@@ -105,8 +111,8 @@ ide_xml_schema_cache_entry_ref (IdeXmlSchemaCacheEntry *self)
 void
 ide_xml_schema_cache_entry_unref (IdeXmlSchemaCacheEntry *self)
 {
-  g_return_if_fail (self);
-  g_return_if_fail (self->ref_count);
+  g_return_if_fail (self != NULL);
+  g_return_if_fail (self->ref_count > 0);
 
   if (g_atomic_int_dec_and_test (&self->ref_count))
     ide_xml_schema_cache_entry_free (self);


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