Port internal uses to use g_source_set_static_name()

This should reduce allocations.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
This commit is contained in:
Philip Withnall
2021-07-26 10:53:02 +01:00
parent 302346d4d3
commit 8e963e0e31
22 changed files with 40 additions and 40 deletions

View File

@@ -249,7 +249,7 @@ g_action_group_exporter_set_events (GActionGroupExporter *exporter,
source = g_idle_source_new ();
exporter->pending_source = source;
g_source_set_callback (source, g_action_group_exporter_dispatch_events, exporter, NULL);
g_source_set_name (source, "[gio] g_action_group_exporter_dispatch_events");
g_source_set_static_name (source, "[gio] g_action_group_exporter_dispatch_events");
g_source_attach (source, exporter->context);
g_source_unref (source);
}

View File

@@ -798,7 +798,7 @@ g_cancellable_source_new (GCancellable *cancellable)
GCancellableSource *cancellable_source;
source = g_source_new (&cancellable_source_funcs, sizeof (GCancellableSource));
g_source_set_name (source, "GCancellable");
g_source_set_static_name (source, "GCancellable");
g_source_set_dispose_function (source, cancellable_source_dispose);
cancellable_source = (GCancellableSource *)source;

View File

@@ -275,7 +275,7 @@ call_destroy_notify (GMainContext *context,
call_destroy_notify_data_in_idle,
data,
(GDestroyNotify) call_destroy_notify_data_free);
g_source_set_name (idle_source, "[gio] call_destroy_notify_data_in_idle");
g_source_set_static_name (idle_source, "[gio] call_destroy_notify_data_in_idle");
g_source_attach (idle_source, context);
g_source_unref (idle_source);
}
@@ -1418,7 +1418,7 @@ schedule_closed_unlocked (GDBusConnection *connection,
emit_closed_in_idle,
data,
(GDestroyNotify) emit_closed_data_free);
g_source_set_name (idle_source, "[gio] emit_closed_in_idle");
g_source_set_static_name (idle_source, "[gio] emit_closed_in_idle");
g_source_attach (idle_source, connection->main_context_at_construction);
g_source_unref (idle_source);
}
@@ -1885,7 +1885,7 @@ send_message_with_reply_cancelled_cb (GCancellable *cancellable,
* via g_cancellable_connect() (e.g. holding lock)
*/
idle_source = g_idle_source_new ();
g_source_set_name (idle_source, "[gio] send_message_with_reply_cancelled_idle_cb");
g_source_set_static_name (idle_source, "[gio] send_message_with_reply_cancelled_idle_cb");
g_task_attach_source (task, idle_source, send_message_with_reply_cancelled_idle_cb);
g_source_unref (idle_source);
}
@@ -3954,7 +3954,7 @@ schedule_callbacks (GDBusConnection *connection,
emit_signal_instance_in_idle_cb,
signal_instance,
(GDestroyNotify) signal_instance_free);
g_source_set_name (idle_source, "[gio] emit_signal_instance_in_idle_cb");
g_source_set_static_name (idle_source, "[gio] emit_signal_instance_in_idle_cb");
g_source_attach (idle_source, subscriber->context);
g_source_unref (idle_source);
}
@@ -4429,9 +4429,9 @@ validate_and_maybe_schedule_property_getset (GDBusConnection *connect
property_data,
(GDestroyNotify) property_data_free);
if (is_get)
g_source_set_name (idle_source, "[gio] invoke_get_property_in_idle_cb");
g_source_set_static_name (idle_source, "[gio] invoke_get_property_in_idle_cb");
else
g_source_set_name (idle_source, "[gio] invoke_set_property_in_idle_cb");
g_source_set_static_name (idle_source, "[gio] invoke_set_property_in_idle_cb");
g_source_attach (idle_source, main_context);
g_source_unref (idle_source);
@@ -4649,7 +4649,7 @@ validate_and_maybe_schedule_property_get_all (GDBusConnection *connec
invoke_get_all_properties_in_idle_cb,
property_get_all_data,
(GDestroyNotify) property_get_all_data_free);
g_source_set_name (idle_source, "[gio] invoke_get_all_properties_in_idle_cb");
g_source_set_static_name (idle_source, "[gio] invoke_get_all_properties_in_idle_cb");
g_source_attach (idle_source, main_context);
g_source_unref (idle_source);
@@ -4966,7 +4966,7 @@ schedule_method_call (GDBusConnection *connection,
call_in_idle_cb,
invocation,
g_object_unref);
g_source_set_name (idle_source, "[gio, " __FILE__ "] call_in_idle_cb");
g_source_set_static_name (idle_source, "[gio, " __FILE__ "] call_in_idle_cb");
g_source_attach (idle_source, main_context);
g_source_unref (idle_source);
}
@@ -6828,7 +6828,7 @@ subtree_message_func (GDBusConnection *connection,
process_subtree_vtable_message_in_idle_cb,
data,
(GDestroyNotify) subtree_deferred_data_free);
g_source_set_name (idle_source, "[gio] process_subtree_vtable_message_in_idle_cb");
g_source_set_static_name (idle_source, "[gio] process_subtree_vtable_message_in_idle_cb");
g_source_attach (idle_source, es->context);
g_source_unref (idle_source);

View File

@@ -197,7 +197,7 @@ schedule_call_in_idle (Client *client, CallType call_type)
call_in_idle_cb,
data,
(GDestroyNotify) call_handler_data_free);
g_source_set_name (idle_source, "[gio, gdbusnameowning.c] call_in_idle_cb");
g_source_set_static_name (idle_source, "[gio, gdbusnameowning.c] call_in_idle_cb");
g_source_attach (idle_source, client->main_context);
g_source_unref (idle_source);
}

View File

@@ -206,7 +206,7 @@ schedule_call_in_idle (Client *client, CallType call_type)
call_in_idle_cb,
data,
(GDestroyNotify) call_handler_data_free);
g_source_set_name (idle_source, "[gio, gdbusnamewatching.c] call_in_idle_cb");
g_source_set_static_name (idle_source, "[gio, gdbusnamewatching.c] call_in_idle_cb");
g_source_attach (idle_source, client->main_context);
g_source_unref (idle_source);
}

View File

@@ -554,7 +554,7 @@ _g_dbus_worker_unfreeze (GDBusWorker *worker)
unfreeze_in_idle_cb,
_g_dbus_worker_ref (worker),
(GDestroyNotify) _g_dbus_worker_unref);
g_source_set_name (idle_source, "[gio] unfreeze_in_idle_cb");
g_source_set_static_name (idle_source, "[gio] unfreeze_in_idle_cb");
g_source_attach (idle_source, worker->shared_thread_data->context);
g_source_unref (idle_source);
}
@@ -1601,7 +1601,7 @@ schedule_writing_unlocked (GDBusWorker *worker,
continue_writing_in_idle_cb,
_g_dbus_worker_ref (worker),
(GDestroyNotify) _g_dbus_worker_unref);
g_source_set_name (idle_source, "[gio] continue_writing_in_idle_cb");
g_source_set_static_name (idle_source, "[gio] continue_writing_in_idle_cb");
g_source_attach (idle_source, worker->shared_thread_data->context);
g_source_unref (idle_source);
}
@@ -1696,7 +1696,7 @@ _g_dbus_worker_new (GIOStream *stream,
_g_dbus_worker_do_initial_read,
_g_dbus_worker_ref (worker),
(GDestroyNotify) _g_dbus_worker_unref);
g_source_set_name (idle_source, "[gio] _g_dbus_worker_do_initial_read");
g_source_set_static_name (idle_source, "[gio] _g_dbus_worker_do_initial_read");
g_source_attach (idle_source, worker->shared_thread_data->context);
g_source_unref (idle_source);

View File

@@ -1085,7 +1085,7 @@ on_run (GSocketService *service,
emit_new_connection_in_idle,
data,
(GDestroyNotify) emit_idle_data_free);
g_source_set_name (idle_source, "[gio] emit_new_connection_in_idle");
g_source_set_static_name (idle_source, "[gio] emit_new_connection_in_idle");
g_source_attach (idle_source, server->main_context_at_construction);
g_source_unref (idle_source);
}

View File

@@ -261,7 +261,7 @@ g_io_scheduler_job_send_to_mainloop (GIOSchedulerJob *job,
g_source_set_priority (source, G_PRIORITY_DEFAULT);
g_source_set_callback (source, mainloop_proxy_func, proxy,
NULL);
g_source_set_name (source, "[gio] mainloop_proxy_func");
g_source_set_static_name (source, "[gio] mainloop_proxy_func");
g_source_attach (source, job->context);
g_source_unref (source);
@@ -318,7 +318,7 @@ g_io_scheduler_job_send_to_mainloop_async (GIOSchedulerJob *job,
g_source_set_priority (source, G_PRIORITY_DEFAULT);
g_source_set_callback (source, mainloop_proxy_func, proxy,
(GDestroyNotify)mainloop_proxy_free);
g_source_set_name (source, "[gio] mainloop_proxy_func");
g_source_set_static_name (source, "[gio] mainloop_proxy_func");
g_source_attach (source, job->context);
g_source_unref (source);

View File

@@ -1667,8 +1667,8 @@ file_is_hidden (const gchar *path,
g_timeout_source_new_seconds (hidden_cache_ttl_secs +
hidden_cache_ttl_jitter_secs);
g_source_set_priority (hidden_cache_source, G_PRIORITY_DEFAULT);
g_source_set_name (hidden_cache_source,
"[gio] remove_from_hidden_cache");
g_source_set_static_name (hidden_cache_source,
"[gio] remove_from_hidden_cache");
g_source_set_callback (hidden_cache_source,
remove_from_hidden_cache,
NULL, NULL);

View File

@@ -658,7 +658,7 @@ g_file_monitor_source_new (gpointer instance,
source = g_source_new (&source_funcs, sizeof (GFileMonitorSource));
fms = (GFileMonitorSource *) source;
g_source_set_name (source, "GFileMonitorSource");
g_source_set_static_name (source, "GFileMonitorSource");
g_mutex_init (&fms->lock);
g_weak_ref_init (&fms->instance_ref, instance);

View File

@@ -467,7 +467,7 @@ queue_network_changed (GNetworkMonitorBase *monitor)
*/
g_source_set_priority (source, G_PRIORITY_HIGH_IDLE);
g_source_set_callback (source, emit_network_changed, monitor, NULL);
g_source_set_name (source, "[gio] emit_network_changed");
g_source_set_static_name (source, "[gio] emit_network_changed");
g_source_attach (source, monitor->priv->context);
monitor->priv->network_changed_source = source;
}

View File

@@ -116,7 +116,7 @@ g_pollable_source_new (GObject *pollable_stream)
G_IS_POLLABLE_OUTPUT_STREAM (pollable_stream), NULL);
source = g_source_new (&pollable_source_funcs, sizeof (GPollableSource));
g_source_set_name (source, "GPollableSource");
g_source_set_static_name (source, "GPollableSource");
pollable_source = (GPollableSource *)source;
pollable_source->stream = g_object_ref (pollable_stream);

View File

@@ -842,7 +842,7 @@ g_simple_async_result_complete_in_idle (GSimpleAsyncResult *simple)
source = g_idle_source_new ();
g_source_set_priority (source, G_PRIORITY_DEFAULT);
g_source_set_callback (source, complete_in_idle_cb, simple, g_object_unref);
g_source_set_name (source, "[gio] complete_in_idle_cb");
g_source_set_static_name (source, "[gio] complete_in_idle_cb");
g_source_attach (source, simple->context);
g_source_unref (source);
@@ -903,7 +903,7 @@ run_in_thread (GIOSchedulerJob *job,
source = g_idle_source_new ();
g_source_set_priority (source, G_PRIORITY_DEFAULT);
g_source_set_callback (source, complete_in_idle_cb_for_thread, data, NULL);
g_source_set_name (source, "[gio] complete_in_idle_cb_for_thread");
g_source_set_static_name (source, "[gio] complete_in_idle_cb_for_thread");
g_source_attach (source, simple->context);
g_source_unref (source);

View File

@@ -4114,7 +4114,7 @@ socket_source_new (GSocket *socket,
condition |= G_IO_HUP | G_IO_ERR | G_IO_NVAL;
source = g_source_new (&socket_source_funcs, sizeof (GSocketSource));
g_source_set_name (source, "GSocket");
g_source_set_static_name (source, "GSocket");
socket_source = (GSocketSource *)source;
socket_source->socket = g_object_ref (socket);

View File

@@ -2177,7 +2177,7 @@ g_task_thread_pool_init (void)
g_thread_pool_set_sort_function (task_pool, g_task_compare_priority, NULL);
task_pool_manager = g_source_new (&trivial_source_funcs, sizeof (GSource));
g_source_set_name (task_pool_manager, "GTask thread pool manager");
g_source_set_static_name (task_pool_manager, "GTask thread pool manager");
g_source_set_callback (task_pool_manager, task_pool_manager_timeout, NULL, NULL);
g_source_set_ready_time (task_pool_manager, -1);
g_source_attach (task_pool_manager,

View File

@@ -1854,7 +1854,7 @@ mtab_file_changed (GFileMonitor *monitor,
source = g_idle_source_new ();
g_source_set_priority (source, G_PRIORITY_DEFAULT);
g_source_set_callback (source, mtab_file_changed_cb, NULL, NULL);
g_source_set_name (source, "[gio] mtab_file_changed_cb");
g_source_set_static_name (source, "[gio] mtab_file_changed_cb");
g_source_attach (source, context);
g_source_unref (source);
}

View File

@@ -381,7 +381,7 @@ ik_source_new (gboolean (* callback) (ik_event_t *event))
source = g_source_new (&source_funcs, sizeof (InotifyKernelSource));
iks = (InotifyKernelSource *) source;
g_source_set_name (source, "inotify kernel source");
g_source_set_static_name (source, "inotify kernel source");
iks->unmatched_moves = g_hash_table_new (NULL, NULL);
iks->fd = inotify_init1 (IN_CLOEXEC);