From bf7661189ebfc366cbebdeb2707b2c6632dc2ff6 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 28 Nov 2017 11:22:01 +0100 Subject: [PATCH] c-list: re-import latest version of c-list.h from upstream Most notably, it renames c_list_unlink_init() -> c_list_unlink() c_list_unlink() -> c_list_unlink_stale() $ sed -e 's/\/c_list_unlink_old/g' \ -e 's/\/c_list_unlink/g' \ -e 's/\/c_list_unlink_stale/g' \ $(git grep -l c_list_unlink -- ':(exclude)shared/nm-utils/c-list.h') \ -i (cherry picked from commit b6efac9ec22563c8df747f883da653d85d188681) --- libnm-core/tests/test-general.c | 2 +- libnm/nm-manager.c | 2 +- libnm/nm-object.c | 6 +++--- shared/nm-utils/c-list.h | 14 +++++++------- shared/nm-utils/nm-dedup-multi.c | 20 ++++++++++---------- src/devices/bluetooth/nm-bluez5-manager.c | 2 +- src/devices/nm-device.c | 2 +- src/nm-act-request.c | 4 ++-- src/nm-firewall-manager.c | 8 ++++---- src/nm-manager.c | 6 +++--- src/nm-pacrunner-manager.c | 6 +++--- src/nm-policy.c | 2 +- src/settings/nm-agent-manager.c | 6 +++--- src/settings/nm-secret-agent.c | 8 ++++---- src/settings/nm-settings-connection.c | 6 +++--- src/settings/plugins/ifcfg-rh/shvar.c | 2 +- 16 files changed, 48 insertions(+), 48 deletions(-) diff --git a/libnm-core/tests/test-general.c b/libnm-core/tests/test-general.c index 188cb28e63..d743fd224a 100644 --- a/libnm-core/tests/test-general.c +++ b/libnm-core/tests/test-general.c @@ -330,7 +330,7 @@ test_c_list_sort (void) if (headless) { lst = head.next; - c_list_unlink (&head); + c_list_unlink_stale (&head); lst = c_list_sort_headless (lst, _c_list_sort_cmp, NULL); g_assert (lst); g_assert (lst->next); diff --git a/libnm/nm-manager.c b/libnm/nm-manager.c index e664b71072..54a951a61d 100644 --- a/libnm/nm-manager.c +++ b/libnm/nm-manager.c @@ -806,7 +806,7 @@ activate_info_complete (ActivateInfo *info, g_simple_async_result_set_from_error (info->simple, error); g_simple_async_result_complete (info->simple); - c_list_unlink (&info->lst); + c_list_unlink_stale (&info->lst); g_free (info->active_path); g_free (info->new_connection_path); diff --git a/libnm/nm-object.c b/libnm/nm-object.c index c344a08dca..c531688001 100644 --- a/libnm/nm-object.c +++ b/libnm/nm-object.c @@ -161,7 +161,7 @@ typedef struct { static void notify_item_free (NotifyItem *item) { - c_list_unlink (&item->lst); + c_list_unlink_stale (&item->lst); g_clear_object (&item->changed); g_slice_free (NotifyItem, item); } @@ -187,7 +187,7 @@ deferred_notify_cb (gpointer data) * list we're iterating. */ c_list_link_after (&priv->notify_items, &props); - c_list_unlink_init (&priv->notify_items); + c_list_unlink (&priv->notify_items); g_object_ref (object); @@ -344,7 +344,7 @@ odata_free (gpointer data) { ObjectCreatedData *odata = data; - c_list_unlink (&odata->lst_pending); + c_list_unlink_stale (&odata->lst_pending); g_object_unref (odata->self); g_free (odata->objects); g_slice_free (ObjectCreatedData, odata); diff --git a/shared/nm-utils/c-list.h b/shared/nm-utils/c-list.h index 557862b6ff..a3c4053b66 100644 --- a/shared/nm-utils/c-list.h +++ b/shared/nm-utils/c-list.h @@ -142,7 +142,7 @@ static inline void c_list_link_after(CList *where, CList *what) { #define c_list_link_front(_list, _what) c_list_link_after((_list), (_what)) /** - * c_list_unlink() - unlink element from list + * c_list_unlink_stale() - unlink element from list * @what: element to unlink * * This unlinks @what. If @what was initialized via C_LIST_INIT(), it has no @@ -150,9 +150,9 @@ static inline void c_list_link_after(CList *where, CList *what) { * * Note that this does not modify @what. It just modifies the previous and next * elements in the list to no longer reference @what. If you want to make sure - * @what is re-initialized after removal, use c_list_unlink_init(). + * @what is re-initialized after removal, use c_list_unlink(). */ -static inline void c_list_unlink(CList *what) { +static inline void c_list_unlink_stale(CList *what) { CList *prev = what->prev, *next = what->next; next->prev = prev; @@ -160,15 +160,15 @@ static inline void c_list_unlink(CList *what) { } /** - * c_list_unlink_init() - unlink element from list and re-initialize + * c_list_unlink() - unlink element from list and re-initialize * @what: element to unlink * - * This is like c_list_unlink() but re-initializes @what after removal. + * This is like c_list_unlink_stale() but re-initializes @what after removal. */ -static inline void c_list_unlink_init(CList *what) { +static inline void c_list_unlink(CList *what) { /* condition is not needed, but avoids STOREs in fast-path */ if (c_list_is_linked(what)) { - c_list_unlink(what); + c_list_unlink_stale(what); *what = (CList)C_LIST_INIT(*what); } } diff --git a/shared/nm-utils/nm-dedup-multi.c b/shared/nm-utils/nm-dedup-multi.c index 8a59f1c466..ee310a7b1b 100644 --- a/shared/nm-utils/nm-dedup-multi.c +++ b/shared/nm-utils/nm-dedup-multi.c @@ -272,13 +272,13 @@ _add (NMDedupMultiIndex *self, if (entry_order) { if ( entry_order != entry && entry->lst_entries.next != &entry_order->lst_entries) { - c_list_unlink (&entry->lst_entries); + c_list_unlink_stale (&entry->lst_entries); c_list_link_before ((CList *) &entry_order->lst_entries, &entry->lst_entries); changed = TRUE; } } else { if (entry->lst_entries.prev != &entry->head->lst_entries_head) { - c_list_unlink (&entry->lst_entries); + c_list_unlink_stale (&entry->lst_entries); c_list_link_front ((CList *) &entry->head->lst_entries_head, &entry->lst_entries); changed = TRUE; } @@ -288,13 +288,13 @@ _add (NMDedupMultiIndex *self, if (entry_order) { if ( entry_order != entry && entry->lst_entries.prev != &entry_order->lst_entries) { - c_list_unlink (&entry->lst_entries); + c_list_unlink_stale (&entry->lst_entries); c_list_link_after ((CList *) &entry_order->lst_entries, &entry->lst_entries); changed = TRUE; } } else { if (entry->lst_entries.next != &entry->head->lst_entries_head) { - c_list_unlink (&entry->lst_entries); + c_list_unlink_stale (&entry->lst_entries); c_list_link_tail ((CList *) &entry->head->lst_entries_head, &entry->lst_entries); changed = TRUE; } @@ -541,12 +541,12 @@ _remove_entry (NMDedupMultiIndex *self, && !g_hash_table_remove (self->idx_entries, head_entry)) nm_assert_not_reached (); - c_list_unlink (&entry->lst_entries); + c_list_unlink_stale (&entry->lst_entries); g_slice_free (NMDedupMultiEntry, entry); if (head_entry) { nm_assert (c_list_is_empty (&head_entry->lst_entries_head)); - c_list_unlink (&head_entry->lst_idx); + c_list_unlink_stale (&head_entry->lst_idx); g_slice_free (NMDedupMultiHeadEntry, head_entry); } @@ -1027,13 +1027,13 @@ nm_dedup_multi_entry_reorder (const NMDedupMultiEntry *entry, nm_assert (c_list_contains (&head_entry->lst_entries_head, &entry->lst_entries)); if (order_after) { if (head_entry->lst_entries_head.prev != &entry->lst_entries) { - c_list_unlink ((CList *) &entry->lst_entries); + c_list_unlink_stale ((CList *) &entry->lst_entries); c_list_link_tail ((CList *) &head_entry->lst_entries_head, (CList *) &entry->lst_entries); return TRUE; } } else { if (head_entry->lst_entries_head.next != &entry->lst_entries) { - c_list_unlink ((CList *) &entry->lst_entries); + c_list_unlink_stale ((CList *) &entry->lst_entries); c_list_link_front ((CList *) &head_entry->lst_entries_head, (CList *) &entry->lst_entries); return TRUE; } @@ -1041,13 +1041,13 @@ nm_dedup_multi_entry_reorder (const NMDedupMultiEntry *entry, } else if (entry != entry_order) { if (order_after) { if (entry_order->lst_entries.next != &entry->lst_entries) { - c_list_unlink ((CList *) &entry->lst_entries); + c_list_unlink_stale ((CList *) &entry->lst_entries); c_list_link_after ((CList *) &entry_order->lst_entries, (CList *) &entry->lst_entries); return TRUE; } } else { if (entry_order->lst_entries.prev != &entry->lst_entries) { - c_list_unlink ((CList *) &entry->lst_entries); + c_list_unlink_stale ((CList *) &entry->lst_entries); c_list_link_before ((CList *) &entry_order->lst_entries, (CList *) &entry->lst_entries); return TRUE; } diff --git a/src/devices/bluetooth/nm-bluez5-manager.c b/src/devices/bluetooth/nm-bluez5-manager.c index 8c93f2a50b..de3f407275 100644 --- a/src/devices/bluetooth/nm-bluez5-manager.c +++ b/src/devices/bluetooth/nm-bluez5-manager.c @@ -158,7 +158,7 @@ static void _network_server_free (NMBluez5Manager *self, NetworkServer *network_server) { _network_server_unregister (self, network_server); - c_list_unlink (&network_server->lst_ns); + c_list_unlink_stale (&network_server->lst_ns); g_free (network_server->path); g_free (network_server->addr); g_slice_free (NetworkServer, network_server); diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 0a942abc73..dc7643cb70 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -2261,7 +2261,7 @@ nm_device_master_release_one_slave (NMDevice *self, NMDevice *slave, gboolean co * Transfers ownership from slave_priv->master. */ self_free = self; - c_list_unlink_init (&info->lst_slave); + c_list_unlink (&info->lst_slave); slave_priv->master = NULL; g_signal_handler_disconnect (slave, info->watch_id); diff --git a/src/nm-act-request.c b/src/nm-act-request.c index 164f44d2cf..87070794fc 100644 --- a/src/nm-act-request.c +++ b/src/nm-act-request.c @@ -132,7 +132,7 @@ get_secrets_cb (NMSettingsConnection *connection, nm_assert (c_list_contains (&priv->call_ids_lst_head, &call_id->call_ids_lst)); - c_list_unlink_init (&call_id->call_ids_lst); + c_list_unlink (&call_id->call_ids_lst); if (call_id->callback) call_id->callback (call_id->self, call_id, connection, error, call_id->callback_data); @@ -215,7 +215,7 @@ _do_cancel_secrets (NMActRequest *self, NMActRequestGetSecretsCallId *call_id, g nm_assert (call_id && call_id->self == self); nm_assert (c_list_contains (&priv->call_ids_lst_head, &call_id->call_ids_lst)); - c_list_unlink_init (&call_id->call_ids_lst); + c_list_unlink (&call_id->call_ids_lst); nm_settings_connection_cancel_secrets (nm_act_request_get_settings_connection (self), call_id->call_id); diff --git a/src/nm-firewall-manager.c b/src/nm-firewall-manager.c index b9878592a6..216d5fc81c 100644 --- a/src/nm-firewall-manager.c +++ b/src/nm-firewall-manager.c @@ -186,7 +186,7 @@ _cb_info_create (NMFirewallManager *self, static void _cb_info_free (CBInfo *info) { - c_list_unlink (&info->lst); + c_list_unlink_stale (&info->lst); if (info->mode != CB_INFO_MODE_IDLE) { if (info->dbus.arg) g_variant_unref (info->dbus.arg); @@ -213,7 +213,7 @@ _cb_info_complete_normal (CBInfo *info, GError *error) nm_assert (c_list_contains (&priv->pending_calls, &info->lst)); - c_list_unlink_init (&info->lst); + c_list_unlink (&info->lst); _cb_info_callback (info, error); _cb_info_free (info); @@ -428,7 +428,7 @@ nm_firewall_manager_cancel_call (NMFirewallManagerCallId call) nm_assert (c_list_contains (&priv->pending_calls, &info->lst)); - c_list_unlink_init (&info->lst); + c_list_unlink (&info->lst); nm_utils_error_set_cancelled (&error, FALSE, "NMFirewallManager"); @@ -527,7 +527,7 @@ again: _handle_dbus_start (self, info); } else { _LOGD (info, "complete: fake success"); - c_list_unlink_init (&info->lst); + c_list_unlink (&info->lst); _cb_info_callback (info, NULL); _cb_info_free (info); goto again; diff --git a/src/nm-manager.c b/src/nm-manager.c index 071d29eaab..f8db9b28e5 100644 --- a/src/nm-manager.c +++ b/src/nm-manager.c @@ -321,7 +321,7 @@ active_connection_remove (NMManager *self, NMActiveConnection *active) notify = nm_exported_object_is_exported (NM_EXPORTED_OBJECT (active)); - c_list_unlink_init (&active->active_connections_lst); + c_list_unlink (&active->active_connections_lst); g_signal_emit (self, signals[ACTIVE_CONNECTION_REMOVED], 0, active); g_signal_handlers_disconnect_by_func (active, active_connection_state_changed, self); g_signal_handlers_disconnect_by_func (active, active_connection_default_changed, self); @@ -2457,7 +2457,7 @@ _platform_link_cb_idle (PlatformLinkCbData *data) NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self); const NMPlatformLink *plink; - c_list_unlink (&data->lst); + c_list_unlink_stale (&data->lst); g_slice_free (PlatformLinkCbData, data); plink = nm_platform_link_get (priv->platform, ifindex); @@ -6403,7 +6403,7 @@ dispose (GObject *object) PlatformLinkCbData *data = c_list_entry (iter, PlatformLinkCbData, lst); g_source_remove (data->idle_id); - c_list_unlink (iter); + c_list_unlink_stale (iter); g_slice_free (PlatformLinkCbData, data); } diff --git a/src/nm-pacrunner-manager.c b/src/nm-pacrunner-manager.c index 08e10e40db..36f517a2af 100644 --- a/src/nm-pacrunner-manager.c +++ b/src/nm-pacrunner-manager.c @@ -128,7 +128,7 @@ config_unref (Config *config) if (config->refcount == 1) { g_variant_unref (config->args); g_free (config->path); - c_list_unlink (&config->lst); + c_list_unlink_stale (&config->lst); g_slice_free (Config, config); } else config->refcount--; @@ -524,7 +524,7 @@ nm_pacrunner_manager_remove (NMPacrunnerManager *self, NMPacrunnerCallId *call_i } } - c_list_unlink_init (&config->lst); + c_list_unlink (&config->lst); config_unref (config); } @@ -570,7 +570,7 @@ dispose (GObject *object) CList *iter, *safe; c_list_for_each_safe (iter, safe, &priv->configs) { - c_list_unlink_init (iter); + c_list_unlink (iter); config_unref (c_list_entry (iter, Config, lst)); } diff --git a/src/nm-policy.c b/src/nm-policy.c index f5fac088f0..65c1c0cf1e 100644 --- a/src/nm-policy.c +++ b/src/nm-policy.c @@ -1140,7 +1140,7 @@ static void activate_data_free (ActivateData *data) { nm_device_remove_pending_action (data->device, NM_PENDING_ACTION_AUTOACTIVATE, TRUE); - c_list_unlink (&data->pending_lst); + c_list_unlink_stale (&data->pending_lst); nm_clear_g_source (&data->autoactivate_id); g_object_unref (data->device); g_slice_free (ActivateData, data); diff --git a/src/settings/nm-agent-manager.c b/src/settings/nm-agent-manager.c index 345d6e6611..a68db47e33 100644 --- a/src/settings/nm-agent-manager.c +++ b/src/settings/nm-agent-manager.c @@ -622,7 +622,7 @@ req_complete (Request *req, nm_assert (c_list_contains (&NM_AGENT_MANAGER_GET_PRIVATE (self)->requests, &req->lst_request)); - c_list_unlink_init (&req->lst_request); + c_list_unlink (&req->lst_request); req_complete_release (req, secrets, agent_dbus_owner, agent_username, error); } @@ -1280,7 +1280,7 @@ nm_agent_manager_cancel_secrets (NMAgentManager *self, nm_assert (c_list_contains (&NM_AGENT_MANAGER_GET_PRIVATE (self)->requests, &request_id->lst_request)); - c_list_unlink_init (&request_id->lst_request); + c_list_unlink (&request_id->lst_request); req_complete_cancel (request_id, FALSE); } @@ -1602,7 +1602,7 @@ dispose (GObject *object) cancel_more: c_list_for_each (iter, &priv->requests) { - c_list_unlink_init (iter); + c_list_unlink (iter); req_complete_cancel (c_list_entry (iter, Request, lst_request), TRUE); goto cancel_more; } diff --git a/src/settings/nm-secret-agent.c b/src/settings/nm-secret-agent.c index 5cb0ce4538..192e9877f2 100644 --- a/src/settings/nm-secret-agent.c +++ b/src/settings/nm-secret-agent.c @@ -146,7 +146,7 @@ request_free (NMSecretAgentCallId *r) NMSecretAgent *self = r->agent; _LOGt ("request "LOG_REQ_FMT": destroyed", LOG_REQ_ARG (r)); - c_list_unlink (&r->lst); + c_list_unlink_stale (&r->lst); g_free (r->path); g_free (r->setting_name); if (r->cancellable) @@ -165,7 +165,7 @@ request_check_return (NMSecretAgentCallId *r) nm_assert (c_list_contains (&NM_SECRET_AGENT_GET_PRIVATE (r->agent)->requests, &r->lst)); - c_list_unlink_init (&r->lst); + c_list_unlink (&r->lst); return TRUE; } @@ -479,7 +479,7 @@ nm_secret_agent_cancel_secrets (NMSecretAgent *self, NMSecretAgentCallId *call_i nm_assert (c_list_contains (&NM_SECRET_AGENT_GET_PRIVATE (self)->requests, &r->lst)); - c_list_unlink_init (&r->lst); + c_list_unlink (&r->lst); do_cancel_secrets (self, r, FALSE); } @@ -763,7 +763,7 @@ dispose (GObject *object) again: c_list_for_each (iter, &priv->requests) { - c_list_unlink_init (iter); + c_list_unlink (iter); do_cancel_secrets (self, c_list_entry (iter, NMSecretAgentCallId, lst), TRUE); goto again; } diff --git a/src/settings/nm-settings-connection.c b/src/settings/nm-settings-connection.c index 9f966a6632..00f357696d 100644 --- a/src/settings/nm-settings-connection.c +++ b/src/settings/nm-settings-connection.c @@ -1035,7 +1035,7 @@ get_secrets_done_cb (NMAgentManager *manager, nm_assert (c_list_contains (&priv->call_ids_lst_head, &call_id->call_ids_lst)); - c_list_unlink_init (&call_id->call_ids_lst); + c_list_unlink (&call_id->call_ids_lst); if (error) { _LOGD ("(%s:%p) secrets request error: %s", @@ -1182,7 +1182,7 @@ get_secrets_idle_cb (NMSettingsConnectionCallId *call_id) nm_assert (c_list_contains (&priv->call_ids_lst_head, &call_id->call_ids_lst)); - c_list_unlink_init (&call_id->call_ids_lst); + c_list_unlink (&call_id->call_ids_lst); _get_secrets_info_callback (call_id, NULL, NULL, call_id->t.idle.error); @@ -1325,7 +1325,7 @@ _get_secrets_cancel (NMSettingsConnection *self, nm_assert (c_list_contains (&priv->call_ids_lst_head, &call_id->call_ids_lst)); - c_list_unlink_init (&call_id->call_ids_lst); + c_list_unlink (&call_id->call_ids_lst); if (call_id->type == CALL_ID_TYPE_REQ) nm_agent_manager_cancel_secrets (priv->agent_mgr, call_id->t.req.id); diff --git a/src/settings/plugins/ifcfg-rh/shvar.c b/src/settings/plugins/ifcfg-rh/shvar.c index 3c09b66dd6..3a5a3f7cfc 100644 --- a/src/settings/plugins/ifcfg-rh/shvar.c +++ b/src/settings/plugins/ifcfg-rh/shvar.c @@ -776,7 +776,7 @@ line_free (shvarLine *line) ASSERT_shvarLine (line); g_free (line->line); g_free (line->key_with_prefix); - c_list_unlink (&line->lst); + c_list_unlink_stale (&line->lst); g_slice_free (shvarLine, line); }