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\>/c_list_unlink_old/g' \
        -e 's/\<c_list_unlink_init\>/c_list_unlink/g' \
        -e 's/\<c_list_unlink_old\>/c_list_unlink_stale/g' \
        $(git grep -l c_list_unlink -- ':(exclude)shared/nm-utils/c-list.h') \
        -i

(cherry picked from commit b6efac9ec2)
This commit is contained in:
Thomas Haller 2017-11-28 11:22:01 +01:00
parent eb95d6bbbb
commit bf7661189e
16 changed files with 48 additions and 48 deletions

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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);
}
}

View file

@ -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;
}

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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;

View file

@ -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);
}

View file

@ -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));
}

View file

@ -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);

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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);

View file

@ -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);
}