Stop using g_sequence_get_length() to check if it's empty

g_sequence_is_empty() is more efficient for that task.

https://bugzilla.gnome.org/show_bug.cgi?id=756988
This commit is contained in:
Xavier Claessens 2015-10-30 10:02:06 -04:00
parent 2bc32606c7
commit df352203d6
4 changed files with 6 additions and 6 deletions

View File

@ -625,7 +625,7 @@ g_dbus_menu_group_changed (GDBusMenuGroup *group,
while (g_variant_iter_loop (&iter, "@a{sv}", &item))
g_sequence_insert_before (point, g_dbus_menu_group_create_item (item));
if (g_sequence_get_length (items) == 0)
if (g_sequence_is_empty (items))
{
g_hash_table_remove (group->menus, GINT_TO_POINTER (menu_id));
items = NULL;

View File

@ -504,7 +504,7 @@ g_file_monitor_source_dispatch (GSource *source,
g_mutex_lock (&fms->lock);
/* Create events for any pending changes that are due to fire */
while (g_sequence_get_length (fms->pending_changes))
while (!g_sequence_is_empty (fms->pending_changes))
{
GSequenceIter *iter = g_sequence_get_begin_iter (fms->pending_changes);
PendingChange *pending = g_sequence_get (iter);
@ -572,7 +572,7 @@ g_file_monitor_source_dispose (GFileMonitorSource *fms)
while ((event = g_queue_pop_head (&fms->event_queue)))
queued_event_free (event);
g_assert (g_sequence_get_length (fms->pending_changes) == 0);
g_assert (g_sequence_is_empty (fms->pending_changes));
g_assert (g_hash_table_size (fms->pending_changes_table) == 0);
g_assert (fms->event_queue.length == 0);
fms->instance = NULL;
@ -592,7 +592,7 @@ g_file_monitor_source_finalize (GSource *source)
/* should already have been cleared in dispose of the monitor */
g_assert (fms->instance == NULL);
g_assert (g_sequence_get_length (fms->pending_changes) == 0);
g_assert (g_sequence_is_empty (fms->pending_changes));
g_assert (g_hash_table_size (fms->pending_changes_table) == 0);
g_assert (fms->event_queue.length == 0);

View File

@ -377,7 +377,7 @@ g_menu_exporter_group_subscribe (GMenuExporterGroup *group,
guint id = GPOINTER_TO_INT (key);
GMenuExporterMenu *menu = val;
if (g_sequence_get_length (menu->item_links))
if (!g_sequence_is_empty (menu->item_links))
{
g_variant_builder_open (builder, G_VARIANT_TYPE ("(uuaa{sv})"));
g_variant_builder_add (builder, "u", group->id);

View File

@ -883,7 +883,7 @@ g_sequence_sort_iter (GSequence *seq,
seq->access_prohibited = TRUE;
tmp->access_prohibited = TRUE;
while (g_sequence_get_length (tmp) > 0)
while (!g_sequence_is_empty (tmp))
{
GSequenceNode *node = g_sequence_get_begin_iter (tmp);