Commit bb90a9fa authored by Christian Hergert's avatar Christian Hergert
Browse files

build: use g_clear_pointer()

We don't need to use dzl_clear_pointer() anymore now that GLib has access
to g_clear_pointer() that performs similar checks as dzl_clear_pointer().
parent 3fe21e73
......@@ -66,8 +66,8 @@ static void
_##prefix##_action_info_free (gpointer data) \
{ \
Type##ActionInfo *info = data; \
dzl_clear_pointer (&info->state, g_variant_unref); \
dzl_clear_pointer (&info->state_hint, g_variant_unref); \
g_clear_pointer (&info->state, g_variant_unref); \
g_clear_pointer (&info->state_hint, g_variant_unref); \
g_slice_free (Type##ActionInfo, info); \
} \
\
......@@ -106,7 +106,7 @@ prefix##_set_action_state (Type *self,
name); \
if (state != info->state) \
{ \
dzl_clear_pointer (&info->state, g_variant_unref); \
g_clear_pointer (&info->state, g_variant_unref); \
info->state = state ? g_variant_ref_sink (state) : NULL; \
g_action_group_action_state_changed (G_ACTION_GROUP (self), name, state); \
} \
......
......@@ -150,7 +150,7 @@ get_action_state (GObject *object,
if (eval != NULL)
ret = g_variant_new_string (eval->value_nick);
dzl_clear_pointer (&eclass, g_type_class_unref);
g_clear_pointer (&eclass, g_type_class_unref);
break;
}
......@@ -413,12 +413,12 @@ dzl_properties_group_change_action_state (GActionGroup *group,
{
g_value_init (&value, mapping->property_type);
g_value_set_enum (&value, eval->value);
dzl_clear_pointer (&eclass, g_type_class_unref);
g_clear_pointer (&eclass, g_type_class_unref);
break;
}
}
dzl_clear_pointer (&eclass, g_type_class_unref);
g_clear_pointer (&eclass, g_type_class_unref);
g_warning ("Failed to transform '%s' to %s",
str, g_type_name (mapping->property_type));
return;
......@@ -682,7 +682,7 @@ dzl_properties_group_finalize (GObject *object)
g_weak_ref_clear (&self->object_ref);
dzl_clear_pointer (&self->mappings, g_array_unref);
g_clear_pointer (&self->mappings, g_array_unref);
G_OBJECT_CLASS (dzl_properties_group_parent_class)->finalize (object);
}
......@@ -867,7 +867,7 @@ dzl_properties_group_add_property_full (DzlPropertiesGroup *self,
g_action_group_action_added (G_ACTION_GROUP (self), mapping.action_name);
failure:
dzl_clear_pointer (&object_class, g_type_class_unref);
g_clear_pointer (&object_class, g_type_class_unref);
}
/**
......@@ -980,7 +980,7 @@ dzl_properties_group_add_all_properties (DzlPropertiesGroup *self)
}
failure:
dzl_clear_pointer (&object_class, g_type_class_unref);
g_clear_pointer (&object_class, g_type_class_unref);
}
/**
......
......@@ -81,9 +81,9 @@ dzl_settings_flag_action_finalize (GObject *object)
{
DzlSettingsFlagAction *self = (DzlSettingsFlagAction *)object;
dzl_clear_pointer (&self->schema_id, g_free);
dzl_clear_pointer (&self->schema_key, g_free);
dzl_clear_pointer (&self->flag_nick, g_free);
g_clear_pointer (&self->schema_id, g_free);
g_clear_pointer (&self->schema_key, g_free);
g_clear_pointer (&self->flag_nick, g_free);
G_OBJECT_CLASS (dzl_settings_flag_action_parent_class)->finalize (object);
}
......
......@@ -342,7 +342,7 @@ dzl_widget_action_group_finalize (GObject *object)
{
DzlWidgetActionGroup *self = (DzlWidgetActionGroup *)object;
dzl_clear_pointer (&self->enabled, g_hash_table_unref);
g_clear_pointer (&self->enabled, g_hash_table_unref);
G_OBJECT_CLASS (dzl_widget_action_group_parent_class)->finalize (object);
}
......
......@@ -216,7 +216,7 @@ dzl_box_theatric_dispose (GObject *object)
self->target = NULL;
}
dzl_clear_pointer (&self->icon_surface, cairo_surface_destroy);
g_clear_pointer (&self->icon_surface, cairo_surface_destroy);
g_clear_object (&self->icon);
G_OBJECT_CLASS (dzl_box_theatric_parent_class)->dispose (object);
......@@ -307,14 +307,14 @@ dzl_box_theatric_set_property (GObject *object,
break;
case PROP_ICON:
dzl_clear_pointer (&theatric->icon_surface, cairo_surface_destroy);
g_clear_pointer (&theatric->icon_surface, cairo_surface_destroy);
g_clear_object (&theatric->icon);
theatric->icon = g_value_dup_object (value);
theatric->pixbuf_failed = FALSE;
break;
case PROP_SURFACE:
dzl_clear_pointer (&theatric->icon_surface, cairo_surface_destroy);
g_clear_pointer (&theatric->icon_surface, cairo_surface_destroy);
theatric->icon_surface = g_value_get_pointer (value);
if (theatric->icon_surface != NULL)
cairo_surface_reference (theatric->icon_surface);
......
......@@ -381,10 +381,10 @@ dzl_application_window_destroy (GtkWidget *widget)
priv->motion_notify_handler = 0;
}
dzl_clear_pointer ((GtkWidget **)&priv->titlebar_container, gtk_widget_destroy);
dzl_clear_pointer ((GtkWidget **)&priv->titlebar_revealer, gtk_widget_destroy);
dzl_clear_pointer ((GtkWidget **)&priv->event_box, gtk_widget_destroy);
dzl_clear_pointer ((GtkWidget **)&priv->overlay, gtk_widget_destroy);
g_clear_pointer ((GtkWidget **)&priv->titlebar_container, gtk_widget_destroy);
g_clear_pointer ((GtkWidget **)&priv->titlebar_revealer, gtk_widget_destroy);
g_clear_pointer ((GtkWidget **)&priv->event_box, gtk_widget_destroy);
g_clear_pointer ((GtkWidget **)&priv->overlay, gtk_widget_destroy);
dzl_clear_source (&priv->fullscreen_source);
dzl_clear_source (&priv->fullscreen_reveal_source);
......
......@@ -215,7 +215,7 @@ dzl_application_startup (GApplication *app)
const gchar *path = g_ptr_array_index (priv->deferred_resources, i);
DZL_APPLICATION_GET_CLASS (self)->add_resources (self, path);
}
dzl_clear_pointer (&priv->deferred_resources, g_ptr_array_unref);
g_clear_pointer (&priv->deferred_resources, g_ptr_array_unref);
/*
* Now force reload the keyboard shortcuts without defering to the main
......@@ -230,8 +230,8 @@ dzl_application_finalize (GObject *object)
DzlApplication *self = (DzlApplication *)object;
DzlApplicationPrivate *priv = dzl_application_get_instance_private (self);
dzl_clear_pointer (&priv->deferred_resources, g_ptr_array_unref);
dzl_clear_pointer (&priv->menu_merge_ids, g_hash_table_unref);
g_clear_pointer (&priv->deferred_resources, g_ptr_array_unref);
g_clear_pointer (&priv->menu_merge_ids, g_hash_table_unref);
g_clear_object (&priv->theme_manager);
g_clear_object (&priv->menu_manager);
g_clear_object (&priv->shortcut_manager);
......
......@@ -249,8 +249,8 @@ lazy_binding_free (gpointer data)
if (lazy_binding->using_closures)
{
dzl_clear_pointer (&lazy_binding->transform_to, g_closure_unref);
dzl_clear_pointer (&lazy_binding->transform_from, g_closure_unref);
g_clear_pointer (&lazy_binding->transform_to, g_closure_unref);
g_clear_pointer (&lazy_binding->transform_from, g_closure_unref);
}
g_slice_free (LazyBinding, lazy_binding);
......@@ -285,7 +285,7 @@ dzl_binding_group_finalize (GObject *object)
g_assert (self->lazy_bindings != NULL);
g_assert (self->lazy_bindings->len == 0);
dzl_clear_pointer (&self->lazy_bindings, g_ptr_array_unref);
g_clear_pointer (&self->lazy_bindings, g_ptr_array_unref);
G_OBJECT_CLASS (dzl_binding_group_parent_class)->finalize (object);
}
......
......@@ -460,7 +460,7 @@ signal_handler_free (gpointer data)
handler->handler_id = 0;
handler->signal_id = 0;
handler->signal_detail = 0;
dzl_clear_pointer (&handler->closure, g_closure_unref);
g_clear_pointer (&handler->closure, g_closure_unref);
g_slice_free (SignalHandler, handler);
}
......@@ -486,7 +486,7 @@ dzl_signal_group_dispose (GObject *object)
if (self->has_bound_at_least_once)
dzl_signal_group_unbind (self);
dzl_clear_pointer (&self->handlers, g_ptr_array_unref);
g_clear_pointer (&self->handlers, g_ptr_array_unref);
G_OBJECT_CLASS (dzl_signal_group_parent_class)->dispose (object);
}
......
......@@ -157,7 +157,7 @@ evict_source_finalize (GSource *source)
{
EvictSource *ev = (EvictSource *)source;
dzl_clear_pointer (&ev->heap, dzl_heap_unref);
g_clear_pointer (&ev->heap, dzl_heap_unref);
}
static GSourceFuncs evict_source_funcs = {
......@@ -172,8 +172,8 @@ cache_item_free (gpointer data)
{
CacheItem *item = data;
dzl_clear_pointer (&item->key, item->self->key_destroy_func);
dzl_clear_pointer (&item->value, item->self->value_destroy_func);
g_clear_pointer (&item->key, item->self->key_destroy_func);
g_clear_pointer (&item->value, item->self->value_destroy_func);
item->self = NULL;
item->evict_at = 0;
......@@ -228,7 +228,7 @@ cancelled_data_free (gpointer data)
{
CancelledData *cancelled = data;
dzl_clear_pointer (&cancelled->key, cancelled->self->key_destroy_func);
g_clear_pointer (&cancelled->key, cancelled->self->key_destroy_func);
g_cancellable_disconnect (cancelled->cancellable, cancelled->cancelled_id);
cancelled->cancelled_id = 0;
......@@ -776,24 +776,24 @@ dzl_task_cache_dispose (GObject *object)
self->evict_source = NULL;
}
dzl_clear_pointer (&self->evict_heap, dzl_heap_unref);
g_clear_pointer (&self->evict_heap, dzl_heap_unref);
if (self->cache != NULL)
{
gint64 count;
count = g_hash_table_size (self->cache);
dzl_clear_pointer (&self->cache, g_hash_table_unref);
g_clear_pointer (&self->cache, g_hash_table_unref);
g_debug ("Evicted cache of %"G_GINT64_FORMAT" items from %s",
count, self->name ?: "unnamed cache");
}
if (self->queued != NULL)
dzl_clear_pointer (&self->queued, g_hash_table_unref);
g_clear_pointer (&self->queued, g_hash_table_unref);
if (self->in_flight != NULL)
dzl_clear_pointer (&self->in_flight, g_hash_table_unref);
g_clear_pointer (&self->in_flight, g_hash_table_unref);
if (self->populate_callback_data)
{
......@@ -809,7 +809,7 @@ dzl_task_cache_finalize (GObject *object)
{
DzlTaskCache *self = (DzlTaskCache *)object;
dzl_clear_pointer (&self->name, g_free);
g_clear_pointer (&self->name, g_free);
G_OBJECT_CLASS (dzl_task_cache_parent_class)->finalize (object);
}
......
......@@ -317,7 +317,7 @@ dzl_directory_model_finalize (GObject *object)
g_clear_object (&self->cancellable);
g_clear_object (&self->directory);
dzl_clear_pointer (&self->items, g_sequence_free);
g_clear_pointer (&self->items, g_sequence_free);
if (self->visible_func_destroy)
self->visible_func_destroy (self->visible_func_data);
......
......@@ -61,7 +61,7 @@ clear_pattern (gpointer data)
{
case PATTERN_GLOB:
g_clear_object (&p->glob.directory);
dzl_clear_pointer (&p->glob.glob, g_free);
g_clear_pointer (&p->glob.glob, g_free);
break;
case PATTERN_FILE:
......@@ -78,7 +78,7 @@ dzl_directory_reaper_finalize (GObject *object)
{
DzlDirectoryReaper *self = (DzlDirectoryReaper *)object;
dzl_clear_pointer (&self->patterns, g_array_unref);
g_clear_pointer (&self->patterns, g_array_unref);
G_OBJECT_CLASS (dzl_directory_reaper_parent_class)->finalize (object);
}
......
......@@ -96,7 +96,7 @@ dzl_file_transfer_finalize (GObject *object)
DzlFileTransfer *self = (DzlFileTransfer *)object;
DzlFileTransferPrivate *priv = dzl_file_transfer_get_instance_private (self);
dzl_clear_pointer (&priv->opers, g_ptr_array_unref);
g_clear_pointer (&priv->opers, g_ptr_array_unref);
G_OBJECT_CLASS (dzl_file_transfer_parent_class)->finalize (object);
}
......
......@@ -476,8 +476,8 @@ dzl_recursive_file_monitor_finalize (GObject *object)
g_clear_object (&self->root);
g_clear_object (&self->cancellable);
dzl_clear_pointer (&self->files_by_monitor, g_hash_table_unref);
dzl_clear_pointer (&self->monitors_by_file, g_hash_table_unref);
g_clear_pointer (&self->files_by_monitor, g_hash_table_unref);
g_clear_pointer (&self->monitors_by_file, g_hash_table_unref);
G_OBJECT_CLASS (dzl_recursive_file_monitor_parent_class)->finalize (object);
}
......
......@@ -330,13 +330,13 @@ dzl_cpu_model_finalize (GObject *object)
DzlCpuModel *self = (DzlCpuModel *)object;
#ifdef __linux__
dzl_clear_pointer (&self->stat_buf, g_free);
g_clear_pointer (&self->stat_buf, g_free);
if (self->stat_fd != -1)
close (self->stat_fd);
#endif
dzl_clear_source (&self->poll_source);
dzl_clear_pointer (&self->cpu_info, g_array_unref);
g_clear_pointer (&self->cpu_info, g_array_unref);
G_OBJECT_CLASS (dzl_cpu_model_parent_class)->finalize (object);
}
......
......@@ -107,7 +107,7 @@ _dzl_graph_view_column_set_n_rows (DzlGraphColumn *self,
ring = dzl_ring_sized_new (sizeof (GValue), n_rows, NULL);
dzl_ring_foreach (self->values, dzl_graph_view_column_copy_value, ring);
dzl_clear_pointer (&self->values, dzl_ring_unref);
g_clear_pointer (&self->values, dzl_ring_unref);
self->values = ring;
}
......@@ -225,8 +225,8 @@ dzl_graph_view_column_finalize (GObject *object)
{
DzlGraphColumn *self = (DzlGraphColumn *)object;
dzl_clear_pointer (&self->name, g_free);
dzl_clear_pointer (&self->values, dzl_ring_unref);
g_clear_pointer (&self->name, g_free);
g_clear_pointer (&self->values, dzl_ring_unref);
G_OBJECT_CLASS (dzl_graph_view_column_parent_class)->finalize (object);
}
......
......@@ -447,7 +447,7 @@ dzl_graph_view_model_finalize (GObject *object)
DzlGraphModel *self = (DzlGraphModel *)object;
DzlGraphModelPrivate *priv = dzl_graph_view_model_get_instance_private (self);
dzl_clear_pointer (&priv->columns, g_ptr_array_unref);
g_clear_pointer (&priv->columns, g_ptr_array_unref);
g_clear_object (&priv->timestamps);
G_OBJECT_CLASS (dzl_graph_view_model_parent_class)->finalize (object);
......
......@@ -288,7 +288,7 @@ dzl_graph_view_size_allocate (GtkWidget *widget,
gtk_widget_get_allocation (widget, &old_alloc);
if ((old_alloc.width != alloc->width) || (old_alloc.height != alloc->height))
dzl_clear_pointer (&priv->surface, cairo_surface_destroy);
g_clear_pointer (&priv->surface, cairo_surface_destroy);
GTK_WIDGET_CLASS (dzl_graph_view_parent_class)->size_allocate (widget, alloc);
}
......@@ -333,7 +333,7 @@ dzl_graph_view_destroy (GtkWidget *widget)
priv->tick_handler = 0;
}
dzl_clear_pointer (&priv->surface, cairo_surface_destroy);
g_clear_pointer (&priv->surface, cairo_surface_destroy);
GTK_WIDGET_CLASS (dzl_graph_view_parent_class)->destroy (widget);
}
......@@ -346,7 +346,7 @@ dzl_graph_view_finalize (GObject *object)
g_clear_object (&priv->model);
g_clear_object (&priv->model_signals);
dzl_clear_pointer (&priv->renderers, g_ptr_array_unref);
g_clear_pointer (&priv->renderers, g_ptr_array_unref);
G_OBJECT_CLASS (dzl_graph_view_parent_class)->finalize (object);
}
......
......@@ -175,7 +175,7 @@ dzl_joined_menu_finalize (GObject *object)
{
DzlJoinedMenu *self = (DzlJoinedMenu *)object;
dzl_clear_pointer (&self->menus, g_array_unref);
g_clear_pointer (&self->menus, g_array_unref);
G_OBJECT_CLASS (dzl_joined_menu_parent_class)->finalize (object);
}
......
......@@ -80,7 +80,7 @@ dzl_menu_manager_dispose (GObject *object)
{
DzlMenuManager *self = (DzlMenuManager *)object;
dzl_clear_pointer (&self->models, g_hash_table_unref);
g_clear_pointer (&self->models, g_hash_table_unref);
G_OBJECT_CLASS (dzl_menu_manager_parent_class)->dispose (object);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment