all: switch GSlice uses over to nm_slice*() macros

for p in \
       g_slice_alloc:nm_slice_alloc \
       g_slice_alloc0:nm_slice_alloc0 \
       g_slice_free:nm_slice_free_typed \
       g_slice_free1:nm_slice_free_sized \
       g_slice_new:nm_slice_new \
       g_slice_new0:nm_slice_new0 \
     ; do
     git grep -l ${p%:*} |
     xargs sed "s/\<${p%:*}\>/${p#*:}/g" -i
  done
  ./contrib/scripts/nm-code-format.sh -u
This commit is contained in:
Thomas Haller 2022-10-06 16:29:05 +02:00
parent 06c7bc6a6b
commit bf9611ac5e
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728
94 changed files with 315 additions and 315 deletions

View file

@ -1004,7 +1004,7 @@ _shutdown_waitobj_unregister(NMShutdownWaitObjHandle *handle)
c_list_unlink_stale(&handle->lst);
if (handle->free_msg_reason)
g_free(handle->msg_reason);
g_slice_free(NMShutdownWaitObjHandle, handle);
nm_slice_free_typed(NMShutdownWaitObjHandle, handle);
/* FIXME(shutdown): check whether the object list is empty, and
* signal shutdown-complete */
@ -1087,7 +1087,7 @@ nm_shutdown_wait_obj_register_full(gpointer watched_obj,
* If you schedule any sources or async operations, you probably need to
* make sure to use the default context. */
handle = g_slice_new(NMShutdownWaitObjHandle);
handle = nm_slice_new(NMShutdownWaitObjHandle);
*handle = (NMShutdownWaitObjHandle){
/* depending on @free_msg_reason, we take ownership of @msg_reason.
* In either case, we just reference the string without cloning

View file

@ -935,7 +935,7 @@ _conn_track_update(NMBluezManager *self,
nm_assert_not_reached();
_conn_track_schedule_notify(self, bt_type, bdaddr);
}
cdata_el = g_slice_new(ConnDataElem);
cdata_el = nm_slice_new(ConnDataElem);
cdata_el->sett_conn = sett_conn;
cdata_el->cdata_hd = cdata_hd;
c_list_link_tail(&cdata_hd->lst_head, &cdata_el->lst);
@ -1141,7 +1141,7 @@ _network_server_vt_register_bridge(const NMBtVTableNetworkServer *vtable,
ifname,
bzobj->d_adapter.address);
r_req_data = g_slice_new(NetworkServerRegisterReqData);
r_req_data = nm_slice_new(NetworkServerRegisterReqData);
*r_req_data = (NetworkServerRegisterReqData){
.int_cancellable = g_cancellable_new(),
.ext_cancellable = g_object_ref(cancellable),
@ -2747,7 +2747,7 @@ nm_bluez_manager_connect(NMBluezManager *self,
bzobj);
}
c_req_data = g_slice_new(DeviceConnectReqData);
c_req_data = nm_slice_new(DeviceConnectReqData);
*c_req_data = (DeviceConnectReqData){
.int_cancellable = g_steal_pointer(&int_cancellable),
.ext_cancellable = g_object_ref(cancellable),

View file

@ -682,7 +682,7 @@ nm_bluez5_dun_connect(const char *adapter,
src_l = strlen(adapter) + 1;
dst_l = strlen(remote) + 1;
cdat = g_slice_new(ConnectData);
cdat = nm_slice_new(ConnectData);
*cdat = (ConnectData){
.callback = callback,
.callback_user_data = callback_user_data,

View file

@ -567,7 +567,7 @@ _peers_remove(NMDeviceWireGuard *self, PeerData *peer_data)
nm_wireguard_peer_unref(peer_data->peer);
if (nm_clear_g_cancellable(&peer_data->ep_resolv.cancellable))
_peers_resolving_cnt_decrement(self);
g_slice_free(PeerData, peer_data);
nm_slice_free_typed(PeerData, peer_data);
if (c_list_is_empty(&priv->lst_peers_head)) {
nm_clear_g_source(&priv->resolve_next_try_id);
@ -587,7 +587,7 @@ _peers_add(NMDeviceWireGuard *self, NMWireGuardPeer *peer)
nm_assert(nm_wireguard_peer_is_sealed(peer));
nm_assert(!_peers_find(priv, peer));
peer_data = g_slice_new(PeerData);
peer_data = nm_slice_new(PeerData);
*peer_data = (PeerData){
.self = self,
.peer = nm_wireguard_peer_ref(peer),

View file

@ -5813,7 +5813,7 @@ concheck_handle_complete(NMDeviceConnectivityHandle *handle, GError *error)
handle->user_data);
}
g_slice_free(NMDeviceConnectivityHandle, handle);
nm_slice_free_typed(NMDeviceConnectivityHandle, handle);
}
static void
@ -5965,7 +5965,7 @@ concheck_start(NMDevice *self,
priv = NM_DEVICE_GET_PRIVATE(self);
handle = g_slice_new0(NMDeviceConnectivityHandle);
handle = nm_slice_new0(NMDeviceConnectivityHandle);
handle->seq = ++seq_counter;
handle->self = self;
handle->callback = callback;
@ -7257,7 +7257,7 @@ sriov_op_queue(NMDevice *self,
* we register a way to abort the last call during shutdown, and after NM_SHUTDOWN_TIMEOUT_MAX_MSEC
* grace period we pull the plug and cancel it. */
op = g_slice_new(SriovOp);
op = nm_slice_new(SriovOp);
*op = (SriovOp){
.num_vfs = num_vfs,
.autoprobe = autoprobe,
@ -7832,7 +7832,7 @@ nm_device_master_add_slave(NMDevice *self, NMDevice *slave, gboolean configure)
g_return_val_if_fail(!slave_priv->master, FALSE);
g_return_val_if_fail(!slave_priv->is_enslaved, FALSE);
info = g_slice_new0(SlaveInfo);
info = nm_slice_new0(SlaveInfo);
info->slave = g_object_ref(slave);
info->configure = configure;
info->watch_id =
@ -13017,7 +13017,7 @@ reapply_cb(NMDevice *self,
if (reapply_data) {
connection = reapply_data->connection;
version_id = reapply_data->version_id;
g_slice_free(ReapplyData, reapply_data);
nm_slice_free_typed(ReapplyData, reapply_data);
}
if (error) {
@ -13127,7 +13127,7 @@ impl_device_reapply(NMDBusObject *obj,
}
if (connection || version_id) {
reapply_data = g_slice_new(ReapplyData);
reapply_data = nm_slice_new(ReapplyData);
reapply_data->connection = connection;
reapply_data->version_id = version_id;
} else
@ -17210,7 +17210,7 @@ nm_device_get_hostname_from_dns_lookup(NMDevice *self, int addr_family, gboolean
resolver = priv->hostname_resolver_x[IS_IPv4];
if (!resolver) {
resolver = g_slice_new(HostnameResolver);
resolver = nm_slice_new(HostnameResolver);
*resolver = (HostnameResolver){
.device = self,
.addr_family = addr_family,

View file

@ -466,7 +466,7 @@ lldp_neighbor_new(sd_lldp_neighbor *neighbor_sd)
s_port_id = nm_utils_bin2hexstr_full(port_id, port_id_len, '\0', FALSE, NULL);
}
neigh = g_slice_new(LldpNeighbor);
neigh = nm_slice_new(LldpNeighbor);
*neigh = (LldpNeighbor){
.neighbor_sd = sd_lldp_neighbor_ref(neighbor_sd),
.chassis_id_type = chassis_id_type,
@ -964,7 +964,7 @@ nm_lldp_listener_new(int ifindex,
r = sd_lldp_rx_set_neighbors_max(lldp_handle, MAX_NEIGHBORS);
nm_assert(r == 0);
self = g_slice_new(NMLldpListener);
self = nm_slice_new(NMLldpListener);
*self = (NMLldpListener){
.ifindex = ifindex,
.notify_callback = notify_callback,

View file

@ -418,7 +418,7 @@ deactivate_async(NMDevice *device,
* ovsdb and wait that changes are picked up.
*/
data = g_slice_new(DeactivateData);
data = nm_slice_new(DeactivateData);
*data = (DeactivateData){
.self = g_object_ref(self),
.cancellable = g_object_ref(cancellable),

View file

@ -171,7 +171,7 @@ attach_port(NMDevice *device,
return FALSE;
}
data = g_slice_new(AttachPortData);
data = nm_slice_new(AttachPortData);
*data = (AttachPortData){
.device = g_object_ref(device),
.port = g_object_ref(port),

View file

@ -382,7 +382,7 @@ ovsdb_call_method(NMOvsdb *self,
/* Ensure we're not unsynchronized before we queue the method call. */
ovsdb_try_connect(self);
call = g_slice_new(OvsdbMethodCall);
call = nm_slice_new(OvsdbMethodCall);
*call = (OvsdbMethodCall){
.self = self,
.call_id = CALL_ID_UNSPEC,
@ -1717,7 +1717,7 @@ ovsdb_got_update(NMOvsdb *self, json_t *msg)
} else {
gs_free char *strtmp = NULL;
ovs_interface = g_slice_new(OpenvswitchInterface);
ovs_interface = nm_slice_new(OpenvswitchInterface);
*ovs_interface = (OpenvswitchInterface){
.interface_uuid = g_strdup(key),
.name = g_strdup(name),
@ -1831,7 +1831,7 @@ ovsdb_got_update(NMOvsdb *self, json_t *msg)
} else {
gs_free char *strtmp = NULL;
ovs_port = g_slice_new(OpenvswitchPort);
ovs_port = nm_slice_new(OpenvswitchPort);
*ovs_port = (OpenvswitchPort){
.port_uuid = g_strdup(key),
.name = g_strdup(name),
@ -1936,7 +1936,7 @@ ovsdb_got_update(NMOvsdb *self, json_t *msg)
} else {
gs_free char *strtmp = NULL;
ovs_bridge = g_slice_new(OpenvswitchBridge);
ovs_bridge = nm_slice_new(OpenvswitchBridge);
*ovs_bridge = (OpenvswitchBridge){
.bridge_uuid = g_strdup(key),
.name = g_strdup(name),
@ -2524,7 +2524,7 @@ ovsdb_call_new(NMOvsdbCallback callback, gpointer user_data)
{
OvsdbCall *call;
call = g_slice_new(OvsdbCall);
call = nm_slice_new(OvsdbCall);
*call = (OvsdbCall){
.callback = callback,
.user_data = user_data,

View file

@ -339,7 +339,7 @@ _scan_request_ssids_track(NMDeviceWifiPrivate *priv, const GPtrArray *ssids)
G_STATIC_ASSERT_EXPR(G_STRUCT_OFFSET(ScanRequestSsidData, ssid) == 0);
d = g_hash_table_lookup(priv->scan_request_ssids_hash, &ssid);
if (!d) {
d = g_slice_new(ScanRequestSsidData);
d = nm_slice_new(ScanRequestSsidData);
*d = (ScanRequestSsidData){
.lst = C_LIST_INIT(d->lst),
.timestamp_msec = now_msec,

View file

@ -462,7 +462,7 @@ known_network_data_free(KnownNetworkData *network)
g_object_unref(network->known_network);
mirror_connection_take_and_delete(network->mirror_connection, network);
g_slice_free(KnownNetworkData, network);
nm_slice_free_typed(KnownNetworkData, network);
}
/*****************************************************************************/
@ -1114,7 +1114,7 @@ interface_added(GDBusObjectManager *object_manager,
g_free(id);
id = orig_id;
} else {
data = g_slice_new0(KnownNetworkData);
data = nm_slice_new0(KnownNetworkData);
data->known_network = g_object_ref(proxy);
data->id = id;
g_hash_table_insert(priv->known_networks, id, data);

View file

@ -351,7 +351,7 @@ connect_context_clear(NMModemBroadband *self)
g_clear_object(&ctx->connection);
g_clear_object(&ctx->connect_properties);
g_clear_object(&ctx->self);
g_slice_free(ConnectContext, ctx);
nm_slice_free_typed(ConnectContext, ctx);
self->_priv.ctx = NULL;
}
}
@ -709,7 +709,7 @@ modem_act_stage1_prepare(NMModem *_self,
connect_context_clear(self);
/* Allocate new context for this connect stage attempt */
self->_priv.ctx = g_slice_new0(ConnectContext);
self->_priv.ctx = nm_slice_new0(ConnectContext);
self->_priv.ctx->caps = mm_modem_get_current_capabilities(self->_priv.modem_iface);
self->_priv.ctx->cancellable = g_cancellable_new();
self->_priv.ctx->connection = g_object_ref(connection);
@ -1209,7 +1209,7 @@ disconnect_context_complete(DisconnectContext *ctx, GError *error)
ctx->callback(NM_MODEM(ctx->self), error, ctx->callback_user_data);
nm_g_object_unref(ctx->cancellable);
g_object_unref(ctx->self);
g_slice_free(DisconnectContext, ctx);
nm_slice_free_typed(DisconnectContext, ctx);
}
static void
@ -1253,7 +1253,7 @@ disconnect(NMModem *modem,
connect_context_clear(self);
_nm_modem_set_apn(NM_MODEM(self), NULL);
ctx = g_slice_new0(DisconnectContext);
ctx = nm_slice_new0(DisconnectContext);
ctx->self = g_object_ref(self);
ctx->cancellable = nm_g_object_ref(cancellable);
ctx->callback = callback;

View file

@ -151,7 +151,7 @@ disconnect_context_complete(DisconnectContext *ctx, GError *error)
ctx->callback(NM_MODEM(ctx->self), error, ctx->callback_user_data);
nm_g_object_unref(ctx->cancellable);
g_object_unref(ctx->self);
g_slice_free(DisconnectContext, ctx);
nm_slice_free_typed(DisconnectContext, ctx);
}
static void
@ -206,7 +206,7 @@ disconnect(NMModem *modem,
_LOGD("warn: %s modem_state: %s", warn ? "TRUE" : "FALSE", nm_modem_state_to_string(state));
ctx = g_slice_new0(DisconnectContext);
ctx = nm_slice_new0(DisconnectContext);
ctx->self = g_object_ref(self);
ctx->cancellable = nm_g_object_ref(cancellable);
ctx->warn = warn;

View file

@ -1216,7 +1216,7 @@ deactivate_context_complete(DeactivateContext *ctx, GError *error)
nm_g_object_unref(ctx->cancellable);
g_object_unref(ctx->device);
g_object_unref(ctx->self);
g_slice_free(DeactivateContext, ctx);
nm_slice_free_typed(DeactivateContext, ctx);
}
static void
@ -1273,7 +1273,7 @@ nm_modem_deactivate_async(NMModem *self,
g_return_if_fail(NM_IS_DEVICE(device));
g_return_if_fail(G_IS_CANCELLABLE(cancellable));
ctx = g_slice_new(DeactivateContext);
ctx = nm_slice_new(DeactivateContext);
ctx->self = g_object_ref(self);
ctx->device = g_object_ref(device);
ctx->cancellable = g_object_ref(cancellable);

View file

@ -349,7 +349,7 @@ finish_parse_context(ParseContext *parse_context, GError *error)
g_free(parse_context->auth_method);
g_slist_free_full(parse_context->dns, g_free);
g_slice_free(ParseContext, parse_context);
nm_slice_free_typed(ParseContext, parse_context);
}
static void read_next_chunk(GInputStream *stream, ParseContext *parse_context);
@ -440,7 +440,7 @@ nm_service_providers_find_gsm_apn(const char *service_provi
GFile *file;
ParseContext *parse_context;
parse_context = g_slice_new0(ParseContext);
parse_context = nm_slice_new0(ParseContext);
parse_context->mccmnc = g_strdup(mccmnc);
parse_context->cancellable = cancellable;
parse_context->callback = callback;

View file

@ -154,7 +154,7 @@ _gl_pid_kill_external_timeout_cb(gpointer user_data)
process_gone:
nm_shutdown_wait_obj_unregister(gl_pid.kill_external_data->shutdown_wait_handle);
g_slice_free(GlPidKillExternalData, g_steal_pointer(&gl_pid.kill_external_data));
nm_slice_free_typed(GlPidKillExternalData, g_steal_pointer(&gl_pid.kill_external_data));
_gl_pid_unlink_pidfile(TRUE);
@ -262,7 +262,7 @@ handle_kill:
pid,
PIDFILE);
gl_pid.kill_external_data = g_slice_new(GlPidKillExternalData);
gl_pid.kill_external_data = nm_slice_new(GlPidKillExternalData);
*gl_pid.kill_external_data = (GlPidKillExternalData){
.shutdown_wait_handle = nm_shutdown_wait_obj_register_handle_full(
g_strdup_printf("kill-external-dnsmasq-process-%" G_PID_FORMAT, pid),
@ -623,7 +623,7 @@ _gl_pid_spawn(const char *dm_binary,
if (dm_binary) {
nm_assert(notify);
nm_assert(G_IS_CANCELLABLE(cancellable));
gl_pid.spawn_data = g_slice_new(GlPidSpawnAsyncData);
gl_pid.spawn_data = nm_slice_new(GlPidSpawnAsyncData);
*gl_pid.spawn_data = (GlPidSpawnAsyncData){
.dm_binary = dm_binary,
.notify = notify,

View file

@ -365,7 +365,7 @@ _dns_config_ip_data_new(NMDnsConfigData *data,
nm_assert(NM_IS_L3_CONFIG_DATA(l3cd));
nm_assert(ip_config_type != NM_DNS_IP_CONFIG_TYPE_REMOVED);
ip_data = g_slice_new(NMDnsConfigIPData);
ip_data = nm_slice_new(NMDnsConfigIPData);
*ip_data = (NMDnsConfigIPData){
.data = data,
.source_tag = source_tag,
@ -2025,7 +2025,7 @@ nm_dns_manager_set_ip_config(NMDnsManager *self,
}
if (!data) {
data = g_slice_new(NMDnsConfigData);
data = nm_slice_new(NMDnsConfigData);
*data = (NMDnsConfigData){
.ifindex = ifindex,
.self = self,

View file

@ -245,7 +245,7 @@ _request_item_append(NMDnsSystemdResolved *self,
NMDnsSystemdResolvedPrivate *priv = NM_DNS_SYSTEMD_RESOLVED_GET_PRIVATE(self);
RequestItem *request_item;
request_item = g_slice_new(RequestItem);
request_item = nm_slice_new(RequestItem);
*request_item = (RequestItem){
.ref_count = 1,
.operation = operation,
@ -710,7 +710,7 @@ update(NMDnsPlugin *plugin,
ic = g_hash_table_lookup(interfaces, GINT_TO_POINTER(ifindex));
if (!ic) {
ic = g_slice_new(InterfaceConfig);
ic = nm_slice_new(InterfaceConfig);
*ic = (InterfaceConfig){
.ifindex = ifindex,
.ip_data_list = g_ptr_array_sized_new(4),
@ -1073,7 +1073,7 @@ nm_dns_systemd_resolved_resolve_address(NMDnsSystemdResolved
nm_assert(addr);
nm_assert(callback);
handle = g_slice_new(NMDnsSystemdResolvedResolveHandle);
handle = nm_slice_new(NMDnsSystemdResolvedResolveHandle);
*handle = (NMDnsSystemdResolvedResolveHandle){
.self = self,
.timeout_msec = timeout_msec,

View file

@ -87,7 +87,7 @@ _get_secrets_call_id_free(NMActRequestGetSecretsCallId *call_id)
if (call_id->has_ref)
g_object_unref(call_id->self);
g_slice_free(NMActRequestGetSecretsCallId, call_id);
nm_slice_free_typed(NMActRequestGetSecretsCallId, call_id);
}
static void
@ -162,7 +162,7 @@ nm_act_request_get_secrets(NMActRequest *self,
settings_connection = nm_act_request_get_settings_connection(self);
applied_connection = nm_act_request_get_applied_connection(self);
call_id = g_slice_new0(NMActRequestGetSecretsCallId);
call_id = nm_slice_new0(NMActRequestGetSecretsCallId);
call_id->has_ref = ref_self;
call_id->self = ref_self ? g_object_ref(self) : self;
call_id->callback = callback;

View file

@ -166,7 +166,7 @@ _call_id_free(NMAuthManagerCallId *call_id)
}
g_object_unref(call_id->self);
g_slice_free(NMAuthManagerCallId, call_id);
nm_slice_free_typed(NMAuthManagerCallId, call_id);
}
static void
@ -326,7 +326,7 @@ nm_auth_manager_check_authorization(NMAuthManager *self
flags = allow_user_interaction ? POLKIT_CHECK_AUTHORIZATION_FLAGS_ALLOW_USER_INTERACTION
: POLKIT_CHECK_AUTHORIZATION_FLAGS_NONE;
call_id = g_slice_new(NMAuthManagerCallId);
call_id = nm_slice_new(NMAuthManagerCallId);
*call_id = (NMAuthManagerCallId){
.self = g_object_ref(self),
.callback = callback,

View file

@ -443,7 +443,7 @@ nm_auth_chain_add_call_unsafe(NMAuthChain *self, const char *permission, gboolea
}
}
call = g_slice_new(AuthCall);
call = nm_slice_new(AuthCall);
*call = (AuthCall){
.chain = self,
.call_id = NULL,
@ -518,7 +518,7 @@ nm_auth_chain_new_subject(NMAuthSubject *subject,
NM_AUTH_SUBJECT_TYPE_INTERNAL));
nm_assert(done_func);
self = g_slice_new(NMAuthChain);
self = nm_slice_new(NMAuthChain);
*self = (NMAuthChain){
.done_func = done_func,
.user_data = user_data,

View file

@ -873,7 +873,7 @@ nm_bond_manager_new(struct _NMPlatform *platform,
nm_assert(NM_IS_PLATFORM(platform));
nm_assert(ifindex > 0);
self = g_slice_new(NMBondManager);
self = nm_slice_new(NMBondManager);
*self = (NMBondManager){
.platform = g_object_ref(platform),
.ifindex = ifindex,

View file

@ -325,7 +325,7 @@ nm_checkpoint_manager_new(NMManager *manager, GParamSpec *spec)
g_return_val_if_fail(NM_IS_MANAGER(manager), FALSE);
self = g_slice_new0(NMCheckpointManager);
self = nm_slice_new0(NMCheckpointManager);
/* the NMCheckpointManager instance is actually owned by NMManager.
* Thus, we cannot take a reference to it, and we also don't bother
@ -346,5 +346,5 @@ nm_checkpoint_manager_free(NMCheckpointManager *self)
return;
nm_checkpoint_manager_destroy_all(self);
g_slice_free(NMCheckpointManager, self);
nm_slice_free_typed(NMCheckpointManager, self);
}

View file

@ -485,7 +485,7 @@ device_checkpoint_destroy(gpointer data)
g_free(dev_checkpoint->original_dev_path);
g_free(dev_checkpoint->original_dev_name);
g_slice_free(DeviceCheckpoint, dev_checkpoint);
nm_slice_free_typed(DeviceCheckpoint, dev_checkpoint);
}
static void
@ -532,7 +532,7 @@ device_checkpoint_create(NMCheckpoint *checkpoint, NMDevice *device)
path = nm_dbus_object_get_path(NM_DBUS_OBJECT(device));
dev_checkpoint = g_slice_new0(DeviceCheckpoint);
dev_checkpoint = nm_slice_new0(DeviceCheckpoint);
dev_checkpoint->device = g_object_ref(device);
dev_checkpoint->original_dev_path = g_strdup(path);
dev_checkpoint->original_dev_name = g_strdup(nm_device_get_iface(device));

View file

@ -2174,7 +2174,7 @@ state_new(void)
{
State *state;
state = g_slice_new0(State);
state = nm_slice_new0(State);
state->p.net_enabled = TRUE;
state->p.wifi_enabled = TRUE;
state->p.wwan_enabled = TRUE;
@ -2187,7 +2187,7 @@ state_free(State *state)
{
if (!state)
return;
g_slice_free(State, state);
nm_slice_free_typed(State, state);
}
static State *

View file

@ -185,7 +185,7 @@ _con_config_unref(ConConfig *con_config)
g_free(con_config->host);
g_free(con_config->port);
g_free(con_config->response);
g_slice_free(ConConfig, con_config);
nm_slice_free_typed(ConConfig, con_config);
}
#if WITH_CONCHECK
@ -262,7 +262,7 @@ cb_data_complete(NMConnectivityCheckHandle *cb_data,
g_free(cb_data->ifspec);
if (cb_data->completed_log_message_free)
g_free(cb_data->completed_log_message_free);
g_slice_free(NMConnectivityCheckHandle, cb_data);
nm_slice_free_typed(NMConnectivityCheckHandle, cb_data);
}
/*****************************************************************************/
@ -487,13 +487,13 @@ multi_socket_cb(CURL *e_handle, curl_socket_t fd, int what, void *userdata, void
*fdp->destroy_notify = TRUE;
nm_clear_g_source_inst(&fdp->source);
curl_multi_assign(cb_data->concheck.curl_mhandle, fd, NULL);
g_slice_free(ConCurlSockData, fdp);
nm_slice_free_typed(ConCurlSockData, fdp);
}
} else {
GIOCondition condition;
if (!fdp) {
fdp = g_slice_new(ConCurlSockData);
fdp = nm_slice_new(ConCurlSockData);
*fdp = (ConCurlSockData){
.cb_data = cb_data,
};
@ -1029,7 +1029,7 @@ nm_connectivity_check_start(NMConnectivity *self,
priv = NM_CONNECTIVITY_GET_PRIVATE(self);
cb_data = g_slice_new0(NMConnectivityCheckHandle);
cb_data = nm_slice_new0(NMConnectivityCheckHandle);
cb_data->self = self;
cb_data->request_counter = ++request_counter;
c_list_link_tail(&priv->handles_lst_head, &cb_data->handles_lst);
@ -1283,7 +1283,7 @@ update_config(NMConnectivity *self, NMConfigData *config_data)
new_port = priv->con_config ? g_strdup(priv->con_config->port) : NULL;
}
_con_config_unref(priv->con_config);
priv->con_config = g_slice_new(ConConfig);
priv->con_config = nm_slice_new(ConConfig);
*priv->con_config = (ConConfig){
.ref_count = 1,
.uri = g_strdup(new_uri),

View file

@ -195,7 +195,7 @@ _object_mgr_data_free(ObjectMgrData *obj_mgr_data)
g_free(obj_mgr_data->fake_sender);
g_slice_free(ObjectMgrData, obj_mgr_data);
nm_slice_free_typed(ObjectMgrData, obj_mgr_data);
}
/*****************************************************************************/
@ -234,7 +234,7 @@ close_connection_in_idle(gpointer user_data)
}
g_object_unref(server->manager);
g_slice_free(CloseConnectionInfo, info);
nm_slice_free_typed(CloseConnectionInfo, info);
return G_SOURCE_REMOVE;
}
@ -253,7 +253,7 @@ private_server_closed_connection(GDBusConnection *conn,
s->tag,
NM_HASH_OBFUSCATE_PTR(conn));
info = g_slice_new0(CloseConnectionInfo);
info = nm_slice_new0(CloseConnectionInfo);
info->connection = conn;
info->server = s;
info->remote_peer_vanished = remote_peer_vanished;
@ -282,7 +282,7 @@ private_server_new_connection(GDBusServer *server, GDBusConnection *conn, gpoint
manager = g_dbus_object_manager_server_new(OBJECT_MANAGER_SERVER_BASE_PATH);
g_dbus_object_manager_server_set_connection(manager, conn);
obj_mgr_data = g_slice_new(ObjectMgrData);
obj_mgr_data = nm_slice_new(ObjectMgrData);
obj_mgr_data->manager = manager;
obj_mgr_data->fake_sender = sender;
c_list_link_tail(&s->object_mgr_lst_head, &obj_mgr_data->object_mgr_lst);
@ -340,7 +340,7 @@ private_server_free(gpointer ptr)
g_object_unref(s->server);
g_slice_free(PrivateServer, s);
nm_slice_free_typed(PrivateServer, s);
}
void
@ -394,7 +394,7 @@ nm_dbus_manager_private_server_register(NMDBusManager *self, const char *path, c
return;
}
s = g_slice_new0(PrivateServer);
s = nm_slice_new0(PrivateServer);
s->address = g_steal_pointer(&address);
s->server = server;
g_signal_connect(server, "new-connection", G_CALLBACK(private_server_new_connection), s);

View file

@ -573,7 +573,7 @@ nm_firewall_nft_call(GBytes *stdin_buf,
FwNftCallData *call_data;
gs_free char *ss1 = NULL;
call_data = g_slice_new(FwNftCallData);
call_data = nm_slice_new(FwNftCallData);
*call_data = (FwNftCallData){
.task =
nm_g_task_new(NULL, cancellable, nm_firewall_nft_call, callback, callback_user_data),
@ -964,7 +964,7 @@ nm_firewall_config_new_shared(const char *ip_iface, in_addr_t addr, guint8 plen)
nm_assert(addr != 0u);
nm_assert(plen <= 32);
self = g_slice_new(NMFirewallConfig);
self = nm_slice_new(NMFirewallConfig);
*self = (NMFirewallConfig){
.ip_iface = g_strdup(ip_iface),
.addr = addr,

View file

@ -189,7 +189,7 @@ _cb_info_create(NMFirewalldManager *self,
NMFirewalldManagerPrivate *priv = NM_FIREWALLD_MANAGER_GET_PRIVATE(self);
NMFirewalldManagerCallId *call_id;
call_id = g_slice_new0(NMFirewalldManagerCallId);
call_id = nm_slice_new0(NMFirewalldManagerCallId);
call_id->self = g_object_ref(self);
call_id->ops_type = ops_type;

View file

@ -687,7 +687,7 @@ nm_l3_config_data_new(NMDedupMultiIndex *multi_idx, int ifindex, NMIPConfigSourc
nm_assert(source == NM_IP_CONFIG_SOURCE_UNKNOWN
|| (source >= NM_IP_CONFIG_SOURCE_KERNEL && source <= NM_IP_CONFIG_SOURCE_USER));
self = g_slice_new(NML3ConfigData);
self = nm_slice_new(NML3ConfigData);
*self = (NML3ConfigData){
.ref_count = 1,
.ifindex = ifindex,

View file

@ -232,7 +232,7 @@ _registration_update(NML3IPv4LL *self,
}
if (!reg) {
reg = g_slice_new(NML3IPv4LLRegistration);
reg = nm_slice_new(NML3IPv4LLRegistration);
*reg = (NML3IPv4LLRegistration){
.self = self,
.timeout_msec = timeout_msec,
@ -961,7 +961,7 @@ nm_l3_ipv4ll_new(NML3Cfg *l3cfg)
g_return_val_if_fail(NM_IS_L3CFG(l3cfg), NULL);
self = g_slice_new(NML3IPv4LL);
self = nm_slice_new(NML3IPv4LL);
*self = (NML3IPv4LL){
.l3cfg = g_object_ref(l3cfg),
.ref_count = 1,

View file

@ -637,7 +637,7 @@ _nm_l3_ipv6ll_new(NML3Cfg *l3cfg,
|| (stable_type != NM_UTILS_STABLE_TYPE_NONE && ifname && network_id && !token_iid),
NULL);
self = g_slice_new(NML3IPv6LL);
self = nm_slice_new(NML3IPv6LL);
*self = (NML3IPv6LL){
.l3cfg = g_object_ref(l3cfg),
.notify_fcn = notify_fcn,

View file

@ -806,7 +806,7 @@ _obj_state_data_new(const NMPObject *obj, const NMPObject *plobj)
{
ObjStateData *obj_state;
obj_state = g_slice_new(ObjStateData);
obj_state = nm_slice_new(ObjStateData);
*obj_state = (ObjStateData){
.obj = nmp_object_ref(obj),
.os_plobj = nmp_object_ref(plobj),
@ -1912,7 +1912,7 @@ _l3_acd_data_add(NML3Cfg *self,
self->priv.p->acd_lst_hash = g_hash_table_new(nm_puint32_hash, nm_puint32_equal);
}
acd_data = g_slice_new(AcdData);
acd_data = nm_slice_new(AcdData);
*acd_data = (AcdData){
.info =
{
@ -4685,7 +4685,7 @@ nm_l3cfg_block_obj_pruning(NML3Cfg *self, int addr_family)
nm_assert(NM_IS_L3CFG(self));
handle = g_slice_new(NML3CfgBlockHandle);
handle = nm_slice_new(NML3CfgBlockHandle);
handle->self = g_object_ref(self);
handle->is_ipv4 = IS_IPv4;
c_list_link_tail(&self->priv.p->blocked_lst_head_x[IS_IPv4], &handle->lst);
@ -4792,7 +4792,7 @@ nm_l3cfg_commit_type_register(NML3Cfg *self,
} else {
if (commit_type == NM_L3_CFG_COMMIT_TYPE_NONE)
goto out;
handle = g_slice_new(NML3CfgCommitTypeHandle);
handle = nm_slice_new(NML3CfgCommitTypeHandle);
if (c_list_is_empty(&self->priv.p->commit_type_lst_head))
g_object_ref(self);
}

View file

@ -489,7 +489,7 @@ _async_op_data_new_authorize_activate_internal(NMManager *self, NMActiveConnecti
{
AsyncOpData *async_op_data;
async_op_data = g_slice_new0(AsyncOpData);
async_op_data = nm_slice_new0(AsyncOpData);
async_op_data->async_op_type = ASYNC_OP_TYPE_AC_AUTH_ACTIVATE_INTERNAL;
async_op_data->self = g_object_ref(self);
async_op_data->ac_auth.active = active_take;
@ -505,7 +505,7 @@ _async_op_data_new_ac_auth_activate_user(NMManager *self,
{
AsyncOpData *async_op_data;
async_op_data = g_slice_new0(AsyncOpData);
async_op_data = nm_slice_new0(AsyncOpData);
async_op_data->async_op_type = ASYNC_OP_TYPE_AC_AUTH_ACTIVATE_USER;
async_op_data->self = g_object_ref(self);
async_op_data->ac_auth.active = active_take;
@ -530,7 +530,7 @@ _async_op_data_new_ac_auth_add_and_activate(NMManager *self
ASYNC_OP_TYPE_AC_AUTH_ADD_AND_ACTIVATE,
ASYNC_OP_TYPE_AC_AUTH_ADD_AND_ACTIVATE2));
async_op_data = g_slice_new0(AsyncOpData);
async_op_data = nm_slice_new0(AsyncOpData);
async_op_data->async_op_type = async_op_type;
async_op_data->self = g_object_ref(self);
async_op_data->ac_auth.active = active_take;
@ -596,7 +596,7 @@ _async_op_complete_ac_auth_cb(NMActiveConnection *active,
g_object_unref(async_op_data->ac_auth.active);
g_object_unref(async_op_data->self);
g_slice_free(AsyncOpData, async_op_data);
nm_slice_free_typed(AsyncOpData, async_op_data);
}
/*****************************************************************************/
@ -621,7 +621,7 @@ _device_route_metric_data_new(int ifindex, guint32 aspired_metric, guint32 effec
nm_assert(aspired_metric > 0);
nm_assert(effective_metric == 0 || aspired_metric <= effective_metric);
data = g_slice_new0(DeviceRouteMetricData);
data = nm_slice_new0(DeviceRouteMetricData);
data->ifindex = ifindex;
data->aspired_metric = aspired_metric;
data->effective_metric = effective_metric ?: aspired_metric;
@ -3810,7 +3810,7 @@ _platform_link_cb_idle(PlatformLinkCbData *data)
const NMPlatformLink *plink;
c_list_unlink_stale(&data->lst);
g_slice_free(PlatformLinkCbData, data);
nm_slice_free_typed(PlatformLinkCbData, data);
plink = nm_platform_link_get(priv->platform, ifindex);
if (plink) {
@ -3865,7 +3865,7 @@ platform_link_cb(NMPlatform *platform,
self = NM_MANAGER(user_data);
priv = NM_MANAGER_GET_PRIVATE(self);
data = g_slice_new(PlatformLinkCbData);
data = nm_slice_new(PlatformLinkCbData);
data->self = self;
data->ifindex = ifindex;
c_list_link_tail(&priv->link_cb_lst, &data->lst);
@ -6988,7 +6988,7 @@ device_connectivity_done(NMDevice *device,
if (data->remaining == 0) {
g_object_unref(self);
g_slice_free(ConnectivityCheckData, data);
nm_slice_free_typed(ConnectivityCheckData, data);
}
}
@ -7018,7 +7018,7 @@ check_connectivity_auth_done_cb(NMAuthChain *chain,
return;
}
data = g_slice_new(ConnectivityCheckData);
data = nm_slice_new(ConnectivityCheckData);
data->self = g_object_ref(self);
data->context = context;
data->remaining = 0;
@ -7505,7 +7505,7 @@ _dbus_set_property_auth_cb(NMAuthChain *chain,
const char *error_message = NULL;
GValue gvalue;
g_slice_free(DBusSetPropertyHandle, handle_data);
nm_slice_free_typed(DBusSetPropertyHandle, handle_data);
c_list_unlink(nm_auth_chain_parent_lst_list(chain));
result = nm_auth_chain_get_result(chain, property_info->writable.permission);
@ -7596,7 +7596,7 @@ nm_manager_dbus_set_property_handle(NMDBusObject *obj,
return;
}
handle_data = g_slice_new0(DBusSetPropertyHandle);
handle_data = nm_slice_new0(DBusSetPropertyHandle);
handle_data->self = g_object_ref(self);
handle_data->obj = g_object_ref(obj);
handle_data->interface_info = interface_info;
@ -8310,7 +8310,7 @@ dispose(GObject *object)
g_source_remove(data->idle_id);
c_list_unlink_stale(&data->lst);
g_slice_free(PlatformLinkCbData, data);
nm_slice_free_typed(PlatformLinkCbData, data);
}
while ((iter = c_list_first(&priv->auth_lst_head)))

View file

@ -160,7 +160,7 @@ nm_netns_l3cfg_acquire(NMNetns *self, int ifindex)
return g_object_ref(l3cfg_data->l3cfg);
}
l3cfg_data = g_slice_new(L3CfgData);
l3cfg_data = nm_slice_new(L3CfgData);
*l3cfg_data = (L3CfgData){
.ifindex = ifindex,
.l3cfg = nm_l3cfg_new(self, ifindex),
@ -295,7 +295,7 @@ nm_netns_shared_ip_reserve(NMNetns *self)
}
}
handle = g_slice_new(NMNetnsSharedIPHandle);
handle = nm_slice_new(NMNetnsSharedIPHandle);
*handle = (NMNetnsSharedIPHandle){
.addr = addr,
._ref_count = 1,

View file

@ -112,7 +112,7 @@ conf_id_unref(NMPacrunnerConfId *conf_id)
g_free(conf_id->path);
c_list_unlink_stale(&conf_id->conf_id_lst);
g_object_unref(conf_id->self);
g_slice_free(NMPacrunnerConfId, conf_id);
nm_slice_free_typed(NMPacrunnerConfId, conf_id);
} else
conf_id->refcount--;
}
@ -364,7 +364,7 @@ nm_pacrunner_manager_add(NMPacrunnerManager *self, const char *iface, const NML3
priv = NM_PACRUNNER_MANAGER_GET_PRIVATE(self);
conf_id = g_slice_new(NMPacrunnerConfId);
conf_id = nm_slice_new(NMPacrunnerConfId);
*conf_id = (NMPacrunnerConfId){
.log_id = ++priv->log_id_counter,
.refcount = 1,

View file

@ -160,7 +160,7 @@ _clear_ip6_subnet(gpointer key, gpointer value, gpointer user_data)
subnet->preferred = 0;
nm_device_use_ip6_subnet(device, subnet);
}
g_slice_free(NMPlatformIP6Address, subnet);
nm_slice_free_typed(NMPlatformIP6Address, subnet);
}
static void
@ -218,7 +218,7 @@ ip6_subnet_from_delegation(IP6PrefixDelegation *delegation, NMDevice *device)
}
/* Allocate a new subnet. */
subnet = g_slice_new0(NMPlatformIP6Address);
subnet = nm_slice_new0(NMPlatformIP6Address);
g_hash_table_insert(delegation->subnets, GINT_TO_POINTER(ifindex), subnet);
subnet->plen = 64;
@ -1292,7 +1292,7 @@ activate_data_free(ActivateData *data)
c_list_unlink_stale(&data->pending_lst);
nm_clear_g_source(&data->autoactivate_id);
g_object_unref(data->device);
g_slice_free(ActivateData, data);
nm_slice_free_typed(ActivateData, data);
}
static void
@ -1483,7 +1483,7 @@ pending_secondary_data_new(NMDevice *device, GSList *secondaries)
{
PendingSecondaryData *data;
data = g_slice_new(PendingSecondaryData);
data = nm_slice_new(PendingSecondaryData);
data->device = g_object_ref(device);
data->secondaries = secondaries;
return data;
@ -1494,7 +1494,7 @@ pending_secondary_data_free(PendingSecondaryData *data)
{
g_object_unref(data->device);
g_slist_free_full(data->secondaries, g_object_unref);
g_slice_free(PendingSecondaryData, data);
nm_slice_free_typed(PendingSecondaryData, data);
}
static void
@ -1694,7 +1694,7 @@ schedule_activate_check(NMPolicy *self, NMDevice *device)
nm_device_add_pending_action(device, NM_PENDING_ACTION_AUTOACTIVATE, TRUE);
data = g_slice_new0(ActivateData);
data = nm_slice_new0(ActivateData);
data->policy = self;
data->device = g_object_ref(device);
data->autoactivate_id = g_idle_add(auto_activate_device_cb, data);

View file

@ -147,7 +147,7 @@ killswitch_new(struct udev_device *device, NMRfkillType rtype)
|| nm_streq0(subsys, "acpi") || nm_streq0(parent_subsys, "acpi"))
platform = TRUE;
ks = g_slice_new(Killswitch);
ks = nm_slice_new(Killswitch);
*ks = (Killswitch){
.name = g_strdup(udev_device_get_sysname(device)),
.seqnum = udev_device_get_seqnum(device),

View file

@ -2759,7 +2759,7 @@ nmtstp_acd_defender_new(int ifindex, in_addr_t ip_addr, const NMEtherAddr *mac_a
g_assert_cmpint(r, ==, 0);
g_assert(probe);
defender = g_slice_new(NMTstpAcdDefender);
defender = nm_slice_new(NMTstpAcdDefender);
*defender = (NMTstpAcdDefender){
.ifindex = ifindex,
.ip_addr = ip_addr,

View file

@ -1167,7 +1167,7 @@ _stop_handle_destroy(NMPPPManagerStopHandle *handle, gboolean was_cancelled)
_stop_handle_complete(handle, was_cancelled);
nm_clear_g_source(&handle->idle_id);
g_clear_object(&handle->shutdown_waitobj);
g_slice_free(NMPPPManagerStopHandle, handle);
nm_slice_free_typed(NMPPPManagerStopHandle, handle);
}
static void
@ -1218,7 +1218,7 @@ _ppp_manager_stop(NMPPPManager *self,
return NULL;
}
handle = g_slice_new0(NMPPPManagerStopHandle);
handle = nm_slice_new0(NMPPPManagerStopHandle);
handle->self = g_object_ref(self);
handle->callback = callback;
handle->user_data = user_data;

View file

@ -561,7 +561,7 @@ nm_ppp_mgr_start(const NMPppMgrConfig *config, GError **error)
if (!ppp_manager)
return NULL;
self = g_slice_new(NMPppMgr);
self = nm_slice_new(NMPppMgr);
*self = (NMPppMgr){
.config = *config,

View file

@ -554,7 +554,7 @@ request_new(NMAgentManager *self,
{
Request *req;
req = g_slice_new0(Request);
req = nm_slice_new0(Request);
req->self = g_object_ref(self);
req->request_type = request_type;
req->detail = g_strdup(detail);
@ -603,7 +603,7 @@ request_free(Request *req)
g_object_unref(req->current);
memset(req, 0, sizeof(Request));
g_slice_free(Request, req);
nm_slice_free_typed(Request, req);
}
static void

View file

@ -141,7 +141,7 @@ _call_id_new(NMSecretAgent *self,
NMSecretAgentPrivate *priv = NM_SECRET_AGENT_GET_PRIVATE(self);
NMSecretAgentCallId *call_id;
call_id = g_slice_new(NMSecretAgentCallId);
call_id = nm_slice_new(NMSecretAgentCallId);
*call_id = (NMSecretAgentCallId){
.self = g_object_ref(self),
.path = g_strdup(path),

View file

@ -77,7 +77,7 @@ _seen_bssid_entry_init_stale(SeenBssidEntry *entry, const NMEtherAddr *bssid_bin
static inline SeenBssidEntry *
_seen_bssid_entry_new_stale_bin(const NMEtherAddr *bssid_bin)
{
return _seen_bssid_entry_init_stale(g_slice_new(SeenBssidEntry), bssid_bin);
return _seen_bssid_entry_init_stale(nm_slice_new(SeenBssidEntry), bssid_bin);
}
static inline SeenBssidEntry *
@ -85,7 +85,7 @@ _seen_bssid_entry_new_stale_copy(const SeenBssidEntry *src)
{
SeenBssidEntry *entry;
entry = g_slice_new(SeenBssidEntry);
entry = nm_slice_new(SeenBssidEntry);
memcpy(entry->bssid, src->bssid, sizeof(entry->bssid));
return entry;
}
@ -696,7 +696,7 @@ _get_secrets_info_free(NMSettingsConnectionCallId *call_id)
g_clear_error(&call_id->t.idle.error);
memset(call_id, 0, sizeof(*call_id));
g_slice_free(NMSettingsConnectionCallId, call_id);
nm_slice_free_typed(NMSettingsConnectionCallId, call_id);
}
typedef struct {
@ -1095,7 +1095,7 @@ nm_settings_connection_get_secrets(NMSettingsConnection *self,
&& (nm_settings_connection_get_connection(self) != applied_connection)),
NULL);
call_id = g_slice_new0(NMSettingsConnectionCallId);
call_id = nm_slice_new0(NMSettingsConnectionCallId);
call_id->self = self;
if (applied_connection) {
call_id->had_applied_connection = TRUE;
@ -1267,7 +1267,7 @@ pk_auth_cb(NMAuthManager *auth_manager,
g_object_unref(auth_data->invocation);
g_object_unref(auth_data->subject);
g_slice_free(AuthData, auth_data);
nm_slice_free_typed(AuthData, auth_data);
}
/**
@ -1328,7 +1328,7 @@ auth_start(NMSettingsConnection *self,
return;
}
auth_data = g_slice_new(AuthData);
auth_data = nm_slice_new(AuthData);
auth_data->self = self;
auth_data->callback = callback;
auth_data->callback_data = callback_data;
@ -1442,7 +1442,7 @@ update_complete(NMSettingsConnection *self, UpdateInfo *info, GError *error)
g_clear_object(&info->new_settings);
g_free(info->audit_args);
g_free(info->plugin_name);
g_slice_free(UpdateInfo, info);
nm_slice_free_typed(UpdateInfo, info);
}
static int
@ -1697,7 +1697,7 @@ settings_connection_update(NMSettingsConnection *self,
&error))
goto error;
info = g_slice_new0(UpdateInfo);
info = nm_slice_new0(UpdateInfo);
info->is_update2 = is_update2;
info->context = context;
info->agent_mgr = g_object_ref(priv->agent_mgr);

View file

@ -88,7 +88,7 @@ _storage_data_new_stale(NMSettingsStorage *storage, NMConnection *connection)
{
StorageData *sd;
sd = g_slice_new(StorageData);
sd = nm_slice_new(StorageData);
sd->storage = g_object_ref(storage);
sd->connection = nm_g_object_ref(connection);
sd->prioritize = FALSE;
@ -101,7 +101,7 @@ _storage_data_destroy(StorageData *sd)
c_list_unlink_stale(&sd->sd_lst);
g_object_unref(sd->storage);
nm_g_object_unref(sd->connection);
g_slice_free(StorageData, sd);
nm_slice_free_typed(StorageData, sd);
}
static StorageData *
@ -692,7 +692,7 @@ _startup_complete_notify_connection(NMSettings *self,
if (!scd) {
if (timeout_msec == 0)
return;
scd = g_slice_new(StartupCompleteData);
scd = nm_slice_new(StartupCompleteData);
*scd = (StartupCompleteData){
.sett_conn = g_object_ref(sett_conn),
.timeout_msec = timeout_msec,

View file

@ -712,7 +712,7 @@ svFile_new(const char *name, int fd, const char *content)
nm_assert(name);
nm_assert(fd >= -1);
s = g_slice_new(shvarFile);
s = nm_slice_new(shvarFile);
*s = (shvarFile){
.fileName = g_strdup(name),
.fd = fd,
@ -786,7 +786,7 @@ line_new_parse(const char *value, gsize len)
nm_assert(value);
line = g_slice_new(shvarLine);
line = nm_slice_new(shvarLine);
*line = (shvarLine){
.lst = C_LIST_INIT(line->lst),
.dirty = TRUE,
@ -826,7 +826,7 @@ line_new_build(const char *key, const char *value)
value = svEscape(value, &value_escaped);
line = g_slice_new(shvarLine);
line = nm_slice_new(shvarLine);
new_key = g_strdup(key), *line = (shvarLine){
.lst = C_LIST_INIT(line->lst),
.line = value_escaped ?: g_strdup(value),
@ -878,7 +878,7 @@ line_free(shvarLine *line)
c_list_unlink_stale(&line->lst);
g_free(line->line);
g_free(line->key_with_prefix);
g_slice_free(shvarLine, line);
nm_slice_free_typed(shvarLine, line);
}
/*****************************************************************************/
@ -1723,5 +1723,5 @@ svCloseFile(shvarFile *s)
g_hash_table_destroy(s->lst_idx);
while ((line = c_list_first_entry(&s->lst_head, shvarLine, lst)))
line_free(line);
g_slice_free(shvarFile, s);
nm_slice_free_typed(shvarFile, s);
}

View file

@ -296,7 +296,7 @@ ifparser_parse(const char *eni_file, int quiet)
{
if_parser *parser;
parser = g_slice_new(if_parser);
parser = nm_slice_new(if_parser);
c_list_init(&parser->block_lst_head);
_recursive_ifparser(parser, eni_file, quiet);
return parser;
@ -327,7 +327,7 @@ ifparser_destroy(if_parser *parser)
while ((ifb = c_list_first_entry(&parser->block_lst_head, if_block, block_lst)))
_destroy_block(ifb);
g_slice_free(if_parser, parser);
nm_slice_free_typed(if_parser, parser);
}
if_block *

View file

@ -81,7 +81,7 @@ _storage_data_destroy(StorageData *sd)
return;
nm_g_object_unref(sd->connection);
nm_g_object_unref(sd->storage);
g_slice_free(StorageData, sd);
nm_slice_free_typed(StorageData, sd);
}
/*****************************************************************************/
@ -329,7 +329,7 @@ load_eni_ifaces(NMSIfupdownPlugin *self)
if (!storage)
storage = nm_settings_storage_new(NM_SETTINGS_PLUGIN(self), uuid, NULL);
sd = g_slice_new(StorageData);
sd = nm_slice_new(StorageData);
*sd = (StorageData){
.connection = g_steal_pointer(&connection),
.storage = g_steal_pointer(&storage),

View file

@ -77,7 +77,7 @@ static void
config_option_free(ConfigOption *opt)
{
g_free(opt->value);
g_slice_free(ConfigOption, opt);
nm_slice_free_typed(ConfigOption, opt);
}
static void
@ -153,7 +153,7 @@ nm_supplicant_config_add_option_with_type(NMSupplicantConfig *self,
return FALSE;
}
opt = g_slice_new0(ConfigOption);
opt = nm_slice_new0(ConfigOption);
opt->value = g_malloc(len + 1);
memcpy(opt->value, value, len);
opt->value[len] = '\0';
@ -237,7 +237,7 @@ nm_supplicant_config_add_blob(NMSupplicantConfig *self,
return FALSE;
}
opt = g_slice_new0(ConfigOption);
opt = nm_slice_new0(ConfigOption);
opt->value = g_strdup_printf("blob://%s", blobid);
opt->len = strlen(opt->value);
opt->type = type;

View file

@ -831,7 +831,7 @@ _bss_info_add(NMSupplicantInterface *self, const char *object_path)
return;
}
bss_info = g_slice_new(NMSupplicantBssInfo);
bss_info = nm_slice_new(NMSupplicantBssInfo);
*bss_info = (NMSupplicantBssInfo){
._self = self,
.bss_path = g_steal_pointer(&bss_path),
@ -1029,7 +1029,7 @@ _peer_info_add(NMSupplicantInterface *self, const char *object_path)
return;
}
peer_info = g_slice_new(NMSupplicantPeerInfo);
peer_info = nm_slice_new(NMSupplicantPeerInfo);
*peer_info = (NMSupplicantPeerInfo){
._self = self,
.peer_path = g_steal_pointer(&peer_path),
@ -1823,7 +1823,7 @@ _wps_start(NMSupplicantInterface *self, const char *type, const char *bssid, con
return;
}
wps_data = g_slice_new(WpsData);
wps_data = nm_slice_new(WpsData);
*wps_data = (WpsData){
.self = self,
.type = g_strdup(type),
@ -2123,7 +2123,7 @@ assoc_return(NMSupplicantInterface *self, GError *error, const char *message)
assoc_data->callback(self, error, assoc_data->user_data);
g_object_unref(assoc_data->cfg);
g_slice_free(AssocData, assoc_data);
nm_slice_free_typed(AssocData, assoc_data);
}
void
@ -2373,7 +2373,7 @@ add_network(NMSupplicantInterface *self)
*
* For that we also have a shutdown_wait_obj so that on exit we still wait
* to handle the response. */
add_network_data = g_slice_new(AddNetworkData);
add_network_data = nm_slice_new(AddNetworkData);
*add_network_data = (AddNetworkData){
.assoc_data = priv->assoc_data,
.name_owner = nm_ref_string_ref(priv->name_owner),
@ -2526,7 +2526,7 @@ nm_supplicant_interface_assoc(NMSupplicantInterface *self,
nm_supplicant_interface_disconnect(self);
assoc_data = g_slice_new(AssocData);
assoc_data = nm_slice_new(AssocData);
*assoc_data = (AssocData){
.self = self,
.cfg = g_object_ref(cfg),
@ -2699,7 +2699,7 @@ nm_supplicant_interface_request_scan(NMSupplicantInterface *se
g_variant_builder_add(&builder, "{sv}", "SSIDs", g_variant_builder_end(&ssids_builder));
}
data = g_slice_new(ScanRequestData);
data = nm_slice_new(ScanRequestData);
*data = (ScanRequestData){
.self = self,
.callback = callback,

View file

@ -692,7 +692,7 @@ nm_supplicant_manager_create_interface(NMSupplicantManager *self
priv = NM_SUPPLICANT_MANAGER_GET_PRIVATE(self);
handle = g_slice_new(NMSupplMgrCreateIfaceHandle);
handle = nm_slice_new(NMSupplMgrCreateIfaceHandle);
*handle = (NMSupplMgrCreateIfaceHandle){
.self = g_object_ref(self),
.callback = callback,

View file

@ -412,7 +412,7 @@ nml_init_data_new_sync(GCancellable *cancellable, GMainLoop *main_loop, GError *
{
NMLInitData *init_data;
init_data = g_slice_new(NMLInitData);
init_data = nm_slice_new(NMLInitData);
*init_data = (NMLInitData){
.cancellable = nm_g_object_ref(cancellable),
.is_sync = TRUE,
@ -430,7 +430,7 @@ nml_init_data_new_async(GCancellable *cancellable, GTask *task_take)
{
NMLInitData *init_data;
init_data = g_slice_new(NMLInitData);
init_data = nm_slice_new(NMLInitData);
*init_data = (NMLInitData){
.cancellable = nm_g_object_ref(cancellable),
.is_sync = FALSE,
@ -1096,7 +1096,7 @@ nml_dbus_object_new(NMRefString *dbus_path_take)
nm_assert(NM_IS_REF_STRING(dbus_path_take));
dbobj = g_slice_new(NMLDBusObject);
dbobj = nm_slice_new(NMLDBusObject);
*dbobj = (NMLDBusObject){
.dbus_path = g_steal_pointer(&dbus_path_take),
.ref_count = 1,
@ -3895,7 +3895,7 @@ _request_wait_start(GTask *task_take,
return;
}
request_data = g_slice_new(RequestWaitData);
request_data = nm_slice_new(RequestWaitData);
*request_data = (RequestWaitData){
.task = g_steal_pointer(&task),
.op_name = op_name,

View file

@ -2993,7 +2993,7 @@ nm_lldp_neighbor_new(void)
{
NMLldpNeighbor *neigh;
neigh = g_slice_new(NMLldpNeighbor);
neigh = nm_slice_new(NMLldpNeighbor);
*neigh = (NMLldpNeighbor){
.refcount = 1,
.attrs = g_hash_table_new_full(nm_str_hash,

View file

@ -47,7 +47,7 @@ nm_dns_entry_new(const char *interface,
NMDnsEntry *entry;
guint i, len;
entry = g_slice_new0(NMDnsEntry);
entry = nm_slice_new0(NMDnsEntry);
entry->refcount = 1;
entry->interface = g_strdup(interface);
@ -117,7 +117,7 @@ nm_dns_entry_unref(NMDnsEntry *entry)
g_free(entry->interface);
g_strfreev(entry->nameservers);
g_strfreev(entry->domains);
g_slice_free(NMDnsEntry, entry);
nm_slice_free_typed(NMDnsEntry, entry);
}
}

View file

@ -475,7 +475,7 @@ impl_get_secrets(NMSecretAgentOld *self, GVariant *parameters, GDBusMethodInvoca
if (info)
_cancel_get_secret_request(self, info, "Request aborted due to new request");
info = g_slice_new(GetSecretsInfo);
info = nm_slice_new(GetSecretsInfo);
*info = (GetSecretsInfo){
.context = context,
.connection_path = g_strdup(arg_connection_path),

View file

@ -88,7 +88,7 @@ _nm_connection_get_private_from_qdata(NMConnection *connection)
priv = g_object_get_qdata((GObject *) connection, key);
if (G_UNLIKELY(!priv)) {
priv = g_slice_new(NMConnectionPrivate);
priv = nm_slice_new(NMConnectionPrivate);
*priv = (NMConnectionPrivate){
.self = connection,
};

View file

@ -18,7 +18,7 @@ dbus_signal_data_free(gpointer data, GClosure *closure)
NMDBusSignalData *sd = data;
g_free(sd->signal_name);
g_slice_free(NMDBusSignalData, sd);
nm_slice_free_typed(NMDBusSignalData, sd);
}
static void
@ -128,7 +128,7 @@ _nm_dbus_signal_connect_data(GDBusProxy *proxy,
g_return_val_if_fail(signature == NULL || g_variant_type_is_tuple(signature), 0);
g_return_val_if_fail(c_handler != NULL, 0);
sd = g_slice_new(NMDBusSignalData);
sd = nm_slice_new(NMDBusSignalData);
sd->signal_name = g_strdup(signal_name);
sd->signature = signature;

View file

@ -148,7 +148,7 @@ nm_bridge_vlan_new(guint16 vid_start, guint16 vid_end)
g_return_val_if_fail(vid_end <= NM_BRIDGE_VLAN_VID_MAX, NULL);
g_return_val_if_fail(vid_start <= vid_end, NULL);
vlan = g_slice_new0(NMBridgeVlan);
vlan = nm_slice_new0(NMBridgeVlan);
vlan->refcount = 1;
vlan->vid_start = vid_start;
vlan->vid_end = vid_end;
@ -192,7 +192,7 @@ nm_bridge_vlan_unref(NMBridgeVlan *vlan)
g_return_if_fail(NM_IS_BRIDGE_VLAN(vlan, TRUE));
if (--vlan->refcount == 0)
g_slice_free(NMBridgeVlan, vlan);
nm_slice_free_typed(NMBridgeVlan, vlan);
}
/**

View file

@ -171,7 +171,7 @@ nm_ip_address_new(int family, const char *addr, guint prefix, GError **error)
if (!valid_prefix(family, prefix, error))
return NULL;
address = g_slice_new(NMIPAddress);
address = nm_slice_new(NMIPAddress);
*address = (NMIPAddress){
.refcount = 1,
.family = family,
@ -206,7 +206,7 @@ nm_ip_address_new_binary(int family, gconstpointer addr, guint prefix, GError **
if (!valid_prefix(family, prefix, error))
return NULL;
address = g_slice_new(NMIPAddress);
address = nm_slice_new(NMIPAddress);
*address = (NMIPAddress){
.refcount = 1,
.family = family,
@ -631,7 +631,7 @@ nm_ip_route_new(int family,
if (!valid_metric(metric, error))
return NULL;
route = g_slice_new(NMIPRoute);
route = nm_slice_new(NMIPRoute);
*route = (NMIPRoute){
.refcount = 1,
.family = family,
@ -677,7 +677,7 @@ nm_ip_route_new_binary(int family,
if (!valid_metric(metric, error))
return NULL;
route = g_slice_new0(NMIPRoute);
route = nm_slice_new0(NMIPRoute);
*route = (NMIPRoute){
.refcount = 1,
.family = family,
@ -1619,7 +1619,7 @@ nm_ip_routing_rule_new(int addr_family)
g_return_val_if_fail(NM_IN_SET(addr_family, AF_INET, AF_INET6), NULL);
self = g_slice_new(NMIPRoutingRule);
self = nm_slice_new(NMIPRoutingRule);
*self = (NMIPRoutingRule){
.ref_count = 1,
.is_v4 = (addr_family == AF_INET),
@ -1647,7 +1647,7 @@ nm_ip_routing_rule_new_clone(const NMIPRoutingRule *rule)
g_return_val_if_fail(NM_IS_IP_ROUTING_RULE(rule, TRUE), NULL);
self = g_slice_new(NMIPRoutingRule);
self = nm_slice_new(NMIPRoutingRule);
*self = (NMIPRoutingRule){
.ref_count = 1,
.sealed = FALSE,

View file

@ -92,7 +92,7 @@ nm_sriov_vf_new(guint index)
{
NMSriovVF *vf;
vf = g_slice_new(NMSriovVF);
vf = nm_slice_new(NMSriovVF);
*vf = (NMSriovVF){
.refcount = 1,
.index = index,
@ -212,7 +212,7 @@ vf_add_vlan(NMSriovVF *vf, guint vlan_id, guint qos, NMSriovVFVlanProtocol proto
{
VFVlan *vlan;
vlan = g_slice_new(VFVlan);
vlan = nm_slice_new(VFVlan);
*vlan = (VFVlan){
.id = vlan_id,
.qos = qos,

View file

@ -72,7 +72,7 @@ nm_tc_qdisc_new(const char *kind, guint32 parent, GError **error)
return NULL;
}
qdisc = g_slice_new0(NMTCQdisc);
qdisc = nm_slice_new0(NMTCQdisc);
qdisc->refcount = 1;
qdisc->kind = g_strdup(kind);
@ -118,7 +118,7 @@ nm_tc_qdisc_unref(NMTCQdisc *qdisc)
g_free(qdisc->kind);
if (qdisc->attributes)
g_hash_table_unref(qdisc->attributes);
g_slice_free(NMTCQdisc, qdisc);
nm_slice_free_typed(NMTCQdisc, qdisc);
}
}
@ -430,7 +430,7 @@ nm_tc_action_new(const char *kind, GError **error)
return NULL;
}
action = g_slice_new0(NMTCAction);
action = nm_slice_new0(NMTCAction);
action->refcount = 1;
action->kind = g_strdup(kind);
@ -475,7 +475,7 @@ nm_tc_action_unref(NMTCAction *action)
g_free(action->kind);
if (action->attributes)
g_hash_table_unref(action->attributes);
g_slice_free(NMTCAction, action);
nm_slice_free_typed(NMTCAction, action);
}
}
@ -715,7 +715,7 @@ nm_tc_tfilter_new(const char *kind, guint32 parent, GError **error)
return NULL;
}
tfilter = g_slice_new0(NMTCTfilter);
tfilter = nm_slice_new0(NMTCTfilter);
tfilter->refcount = 1;
tfilter->kind = g_strdup(kind);
@ -761,7 +761,7 @@ nm_tc_tfilter_unref(NMTCTfilter *tfilter)
g_free(tfilter->kind);
if (tfilter->action)
nm_tc_action_unref(tfilter->action);
g_slice_free(NMTCTfilter, tfilter);
nm_slice_free_typed(NMTCTfilter, tfilter);
}
}

View file

@ -76,7 +76,7 @@ nm_wireguard_peer_new(void)
{
NMWireGuardPeer *self;
self = g_slice_new(NMWireGuardPeer);
self = nm_slice_new(NMWireGuardPeer);
*self = (NMWireGuardPeer){
.refcount = 1,
.preshared_key_flags = NM_SETTING_SECRET_FLAG_NOT_REQUIRED,
@ -103,7 +103,7 @@ nm_wireguard_peer_new_clone(const NMWireGuardPeer *self, gboolean with_secrets)
g_return_val_if_fail(NM_IS_WIREGUARD_PEER(self, TRUE), NULL);
new = g_slice_new(NMWireGuardPeer);
new = nm_slice_new(NMWireGuardPeer);
*new = (NMWireGuardPeer){
.refcount = 1,
.public_key = g_strdup(self->public_key),
@ -175,7 +175,7 @@ nm_wireguard_peer_unref(NMWireGuardPeer *self)
g_ptr_array_unref(self->allowed_ips);
g_free(self->public_key);
nm_free_secret(self->preshared_key);
g_slice_free(NMWireGuardPeer, self);
nm_slice_free_typed(NMWireGuardPeer, self);
}
/**
@ -1099,7 +1099,7 @@ _peer_free(PeerData *pd)
nm_assert(pd);
nm_wireguard_peer_unref(pd->peer);
g_slice_free(PeerData, pd);
nm_slice_free_typed(PeerData, pd);
}
/*****************************************************************************/
@ -1309,7 +1309,7 @@ _peers_set(NMSettingWireGuardPrivate *priv,
}
if (!pd_same_key)
pd_same_key = g_slice_new(PeerData);
pd_same_key = nm_slice_new(PeerData);
*pd_same_key = (PeerData){
.peer = peer,

View file

@ -3650,7 +3650,7 @@ _gendata_hash(NMSetting *setting, gboolean create_if_necessary)
if (G_UNLIKELY(!priv->gendata)) {
if (!create_if_necessary)
return NULL;
priv->gendata = g_slice_new(GenData);
priv->gendata = nm_slice_new(GenData);
priv->gendata->hash = g_hash_table_new_full(nm_str_hash,
g_str_equal,
g_free,
@ -4108,7 +4108,7 @@ finalize(GObject *object)
g_free(priv->gendata->names);
g_free(priv->gendata->values);
g_hash_table_unref(priv->gendata->hash);
g_slice_free(GenData, priv->gendata);
nm_slice_free_typed(GenData, priv->gendata);
}
G_OBJECT_CLASS(nm_setting_parent_class)->finalize(object);

View file

@ -78,7 +78,7 @@ _private_destroy(gpointer data)
g_object_remove_weak_pointer((GObject *) priv->plugin_info,
(gpointer *) &priv->plugin_info);
g_slice_free(NMVpnEditorPluginPrivate, priv);
nm_slice_free_typed(NMVpnEditorPluginPrivate, priv);
}
static NMVpnEditorPluginPrivate *
@ -97,7 +97,7 @@ _private_get(NMVpnEditorPlugin *plugin, gboolean create)
return priv;
if (!create)
return NULL;
priv = g_slice_new0(NMVpnEditorPluginPrivate);
priv = nm_slice_new0(NMVpnEditorPluginPrivate);
g_object_set_qdata_full((GObject *) plugin, quark, priv, _private_destroy);
return priv;
}

View file

@ -524,19 +524,19 @@ test_nm_g_slice_free_fcn(void)
char a2;
} xx;
p = g_slice_new(gint64);
p = nm_slice_new(gint64);
(nm_g_slice_free_fcn(gint64))(p);
p = g_slice_new(gint32);
p = nm_slice_new(gint32);
(nm_g_slice_free_fcn(gint32))(p);
p = g_slice_new(int);
p = nm_slice_new(int);
(nm_g_slice_free_fcn(int))(p);
p = g_slice_new(gint64);
p = nm_slice_new(gint64);
nm_g_slice_free_fcn_gint64(p);
p = g_slice_alloc(sizeof(xx));
p = nm_slice_alloc(sizeof(xx));
(nm_g_slice_free_fcn(xx))(p);
}
@ -1588,7 +1588,7 @@ _dedup_obj_clone(const NMDedupMultiObj *obj)
DedupObj *o, *o2;
o = _dedup_obj_assert(obj);
o2 = g_slice_new0(DedupObj);
o2 = nm_slice_new0(DedupObj);
o2->parent.klass = &dedup_obj_class;
o2->parent._ref_count = 1;
o2->val = o->val;
@ -1604,7 +1604,7 @@ _dedup_obj_destroy(NMDedupMultiObj *obj)
g_assert(o->parent._ref_count == 0);
o->parent._ref_count = 1;
o = _dedup_obj_assert(obj);
g_slice_free(DedupObj, o);
nm_slice_free_typed(DedupObj, o);
}
static void

View file

@ -29,7 +29,7 @@ nm_c_list_elem_new_stale(void *data)
{
NMCListElem *elem;
elem = g_slice_new(NMCListElem);
elem = nm_slice_new(NMCListElem);
elem->data = data;
return elem;
}
@ -42,7 +42,7 @@ nm_c_list_elem_free_full(NMCListElem *elem, GDestroyNotify free_fcn)
c_list_unlink_stale(&elem->lst);
if (free_fcn)
free_fcn(elem->data);
g_slice_free(NMCListElem, elem);
nm_slice_free_typed(NMCListElem, elem);
return TRUE;
}

View file

@ -314,7 +314,7 @@ _add(NMDedupMultiIndex *self,
head_entry = head_existing;
if (!head_entry) {
head_entry = g_slice_new0(NMDedupMultiHeadEntry);
head_entry = nm_slice_new0(NMDedupMultiHeadEntry);
head_entry->is_head = TRUE;
head_entry->idx_type = idx_type;
c_list_init(&head_entry->lst_entries_head);
@ -330,7 +330,7 @@ _add(NMDedupMultiIndex *self,
nm_assert(c_list_contains(&entry_order->lst_entries, &head_entry->lst_entries_head));
}
entry = g_slice_new0(NMDedupMultiEntry);
entry = nm_slice_new0(NMDedupMultiEntry);
entry->obj = obj_new;
entry->head = head_entry;
@ -507,12 +507,12 @@ _remove_entry(NMDedupMultiIndex *self, NMDedupMultiEntry *entry, gboolean *out_h
nm_assert_not_reached();
c_list_unlink_stale(&entry->lst_entries);
g_slice_free(NMDedupMultiEntry, entry);
nm_slice_free_typed(NMDedupMultiEntry, entry);
if (head_entry) {
nm_assert(c_list_is_empty(&head_entry->lst_entries_head));
c_list_unlink_stale(&head_entry->lst_idx);
g_slice_free(NMDedupMultiHeadEntry, head_entry);
nm_slice_free_typed(NMDedupMultiHeadEntry, head_entry);
}
nm_dedup_multi_obj_unref(obj);
@ -1004,7 +1004,7 @@ nm_dedup_multi_index_new(void)
{
NMDedupMultiIndex *self;
self = g_slice_new0(NMDedupMultiIndex);
self = nm_slice_new0(NMDedupMultiIndex);
self->ref_count = 1;
self->idx_entries =
g_hash_table_new((GHashFunc) _dict_idx_entries_hash, (GEqualFunc) _dict_idx_entries_equal);
@ -1060,6 +1060,6 @@ more:
g_hash_table_unref(self->idx_entries);
g_hash_table_unref(self->idx_objs);
g_slice_free(NMDedupMultiIndex, self);
nm_slice_free_typed(NMDedupMultiIndex, self);
return NULL;
}

View file

@ -548,7 +548,7 @@ nm_g_subprocess_terminate_in_background(GSubprocess *subprocess, int timeout_mse
main_context = g_main_context_get_thread_default();
term_data = g_slice_new(SubprocessTerminateData);
term_data = nm_slice_new(SubprocessTerminateData);
*term_data = (SubprocessTerminateData){
.subprocess = g_object_ref(subprocess),
.timeout_source = NULL,

View file

@ -1235,7 +1235,7 @@ _NM_IN_STRSET_EVAL_op_streq_ascii_case(const char *x1, const char *x)
/*****************************************************************************/
#define nm_g_slice_free(ptr) g_slice_free(typeof(*(ptr)), ptr)
#define nm_g_slice_free(ptr) nm_slice_free_typed(typeof(*(ptr)), ptr)
/*****************************************************************************/

View file

@ -4221,7 +4221,7 @@ _nm_utils_user_data_pack(int nargs, gconstpointer *args)
nm_assert(nargs > 0);
nm_assert(args);
data = g_slice_alloc(((gsize) nargs) * sizeof(gconstpointer));
data = nm_slice_alloc(((gsize) nargs) * sizeof(gconstpointer));
for (i = 0; i < nargs; i++)
data[i] = (gpointer) args[i];
return (NMUtilsUserData *) data;
@ -4248,7 +4248,7 @@ _nm_utils_user_data_unpack(NMUtilsUserData *user_data, int nargs, ...)
}
va_end(ap);
g_slice_free1(((gsize) nargs) * sizeof(gconstpointer), data);
nm_slice_free_sized(((gsize) nargs) * sizeof(gconstpointer), data);
}
/*****************************************************************************/
@ -4310,7 +4310,7 @@ _nm_utils_invoke_on_idle_start(gboolean use_timeout,
g_return_if_fail(callback);
data = g_slice_new(InvokeOnIdleData);
data = nm_slice_new(InvokeOnIdleData);
*data = (InvokeOnIdleData){
.callback = callback,
.callback_user_data = callback_user_data,
@ -5043,7 +5043,7 @@ _ctx_integ_source_prepare(GSource *source, int *out_timeout)
poll_data = g_hash_table_lookup(ctx_src->fds, &fd->fd);
if (G_UNLIKELY(!poll_data)) {
poll_data = g_slice_new(PollData);
poll_data = nm_slice_new(PollData);
*poll_data = (PollData){
.fd = fd->fd,
.idx.one = i,
@ -6239,13 +6239,13 @@ nm_utils_thread_local_register_destroy(gpointer tls_data, GDestroyNotify destroy
g_return_if_reached();
if ((lst_head = pthread_getspecific(_tls_reg_key)) == NULL) {
lst_head = g_slice_new(CList);
lst_head = nm_slice_new(CList);
c_list_init(lst_head);
if (pthread_setspecific(_tls_reg_key, lst_head) != 0)
g_return_if_reached();
}
entry = g_slice_new(TlsRegData);
entry = nm_slice_new(TlsRegData);
entry->tls_data = tls_data;
entry->destroy_notify = destroy_notify;
c_list_link_tail(lst_head, &entry->lst);

View file

@ -853,7 +853,7 @@ void _nm_slice_assert_usable_size(gsize mem_size, gpointer mem_block);
#define _nm_g_slice_free_fcn_define(mem_size) \
static inline void _nm_g_slice_free_fcn_##mem_size(gpointer mem_block) \
{ \
g_slice_free1(mem_size, mem_block); \
nm_slice_free_sized(mem_size, mem_block); \
} \
_NM_DUMMY_STRUCT_FOR_TRAILING_SEMICOLON
@ -919,10 +919,10 @@ _nm_get_warn_unused_result_gdestroynotify(GDestroyNotify f)
/**
* nm_g_slice_free_fcn:
* @type: type argument for sizeof() operator that you would
* pass to g_slice_new().
* pass to nm_slice_new().
*
* Returns: a function pointer with GDestroyNotify signature
* for g_slice_free(type,*).
* for nm_slice_free_typed(type,*).
*
* Only certain types are implemented. You'll get a compile time
* error for the wrong types. */

View file

@ -1028,7 +1028,7 @@ nmtst_rand_perm(GRand *rand, void *dst, const void *src, gsize elmt_size, gsize
if (!rand)
rand = nmtst_get_rand();
bu = g_slice_alloc(elmt_size);
bu = nm_slice_alloc(elmt_size);
p_ = dst;
for (i = n_elmt; i > 1; i--) {
@ -1045,7 +1045,7 @@ nmtst_rand_perm(GRand *rand, void *dst, const void *src, gsize elmt_size, gsize
p_ += elmt_size;
}
g_slice_free1(elmt_size, bu);
nm_slice_free_sized(elmt_size, bu);
return dst;
}

View file

@ -2494,7 +2494,7 @@ _wireguard_update_from_peers_nla(CList *peers, GArray **p_allowed_ips, struct nl
* Only parse WGPEER_A_ALLOWEDIPS below. */
} else {
/* otherwise, start a new peer */
peer_c = g_slice_new0(WireGuardPeerConstruct);
peer_c = nm_slice_new0(WireGuardPeerConstruct);
c_list_link_tail(peers, &peer_c->lst);
nla_memcpy(&peer_c->data.public_key,
@ -2704,7 +2704,7 @@ _wireguard_read_info(NMPlatform *platform /* used only as logging context */
while ((peer_c = c_list_first_entry(&parse_data.peers, WireGuardPeerConstruct, lst))) {
c_list_unlink_stale(&peer_c->lst);
nm_explicit_bzero(&peer_c->data.preshared_key, sizeof(peer_c->data.preshared_key));
g_slice_free(WireGuardPeerConstruct, peer_c);
nm_slice_free_typed(WireGuardPeerConstruct, peer_c);
}
return NULL;
}
@ -2751,7 +2751,7 @@ _wireguard_read_info(NMPlatform *platform /* used only as logging context */
c_list_unlink_stale(&peer_c->lst);
nm_explicit_bzero(&peer_c->data.preshared_key, sizeof(peer_c->data.preshared_key));
g_slice_free(WireGuardPeerConstruct, peer_c);
nm_slice_free_typed(WireGuardPeerConstruct, peer_c);
if (peer->_construct_idx_end != 0) {
guint len;
@ -5756,7 +5756,7 @@ sysctl_async_info_free(SysctlAsyncInfo *info)
g_free(info->path);
g_strfreev(info->values);
g_object_unref(info->cancellable);
g_slice_free(SysctlAsyncInfo, info);
nm_slice_free_typed(SysctlAsyncInfo, info);
}
static void
@ -5878,7 +5878,7 @@ sysctl_set_async(NMPlatform *platform,
} else
dirfd_dup = -1;
info = g_slice_new0(SysctlAsyncInfo);
info = nm_slice_new0(SysctlAsyncInfo);
info->platform = g_object_ref(platform);
info->pathid = g_strdup(pathid);
info->dirfd = dirfd_dup;

View file

@ -374,7 +374,7 @@ nlmsg_alloc_size(size_t len)
else if (len > UINT32_MAX)
g_return_val_if_reached(NULL);
nm = g_slice_new(struct nl_msg);
nm = nm_slice_new(struct nl_msg);
*nm = (struct nl_msg){
.nm_protocol = -1,
.nm_size = len,
@ -429,7 +429,7 @@ nlmsg_free(struct nl_msg *msg)
return;
g_free(msg->nm_nlh);
g_slice_free(struct nl_msg, msg);
nm_slice_free_typed(struct nl_msg, msg);
}
/*****************************************************************************/
@ -1124,7 +1124,7 @@ nl_socket_new(struct nl_sock **out_sk,
t = time(NULL);
sk = g_slice_new(struct nl_sock);
sk = nm_slice_new(struct nl_sock);
*sk = (struct nl_sock){
.s_fd = nm_steal_fd(&fd),
.s_local =

View file

@ -5554,7 +5554,7 @@ nm_platform_ip4_dev_route_blacklist_set(NMPlatform *self,
_LOGT("ip4-dev-route: register %s",
nmp_object_to_string(o, NMP_OBJECT_TO_STRING_PUBLIC, sbuf, sizeof(sbuf)));
p_timeout_ms = g_slice_new(gint64);
p_timeout_ms = nm_slice_new(gint64);
*p_timeout_ms = timeout_msec_val;
g_hash_table_replace(priv->ip4_dev_route_blacklist_hash,
(gpointer) nmp_object_ref(o),

View file

@ -421,7 +421,7 @@ nmp_global_tracker_track(NMPGlobalTracker *self,
track_data = _track_data_lookup(self->by_data, p_obj_stack, user_tag);
if (!track_data) {
track_data = g_slice_new(TrackData);
track_data = nm_slice_new(TrackData);
*track_data = (TrackData){
.obj = nm_dedup_multi_index_obj_intern(nm_platform_get_multi_idx(self->platform),
p_obj_stack),
@ -434,7 +434,7 @@ nmp_global_tracker_track(NMPGlobalTracker *self,
obj_data = g_hash_table_lookup(self->by_obj, &track_data->obj);
if (!obj_data) {
obj_data = g_slice_new(TrackObjData);
obj_data = nm_slice_new(TrackObjData);
*obj_data = (TrackObjData){
.obj = nmp_object_ref(track_data->obj),
.obj_lst_head = C_LIST_INIT(obj_data->obj_lst_head),
@ -447,7 +447,7 @@ nmp_global_tracker_track(NMPGlobalTracker *self,
user_tag_data = g_hash_table_lookup(self->by_user_tag, &track_data->user_tag);
if (!user_tag_data) {
user_tag_data = g_slice_new(TrackUserTagData);
user_tag_data = nm_slice_new(TrackUserTagData);
*user_tag_data = (TrackUserTagData){
.user_tag = user_tag,
.user_tag_lst_head = C_LIST_INIT(user_tag_data->user_tag_lst_head),
@ -1226,7 +1226,7 @@ nmp_global_tracker_new(NMPlatform *platform)
G_STATIC_ASSERT_EXPR(G_STRUCT_OFFSET(TrackUserTagData, user_tag) == 0);
self = g_slice_new(NMPGlobalTracker);
self = nm_slice_new(NMPGlobalTracker);
*self = (NMPGlobalTracker){
.ref_count = 1,
.platform = g_object_ref(platform),

View file

@ -771,7 +771,7 @@ _nmp_object_new_from_class(const NMPClass *klass)
nm_assert(klass->sizeof_data > 0);
nm_assert(klass->sizeof_public > 0 && klass->sizeof_public <= klass->sizeof_data);
obj = g_slice_alloc0(klass->sizeof_data + G_STRUCT_OFFSET(NMPObject, object));
obj = nm_slice_alloc0(klass->sizeof_data + G_STRUCT_OFFSET(NMPObject, object));
obj->_class = klass;
obj->parent._ref_count = 1;
return obj;
@ -1859,7 +1859,7 @@ _vt_dedup_obj_destroy(NMDedupMultiObj *obj)
klass = o->_class;
if (klass->cmd_obj_dispose)
klass->cmd_obj_dispose(o);
g_slice_free1(klass->sizeof_data + G_STRUCT_OFFSET(NMPObject, object), o);
nm_slice_free_sized(klass->sizeof_data + G_STRUCT_OFFSET(NMPObject, object), o);
}
static const NMDedupMultiObj *
@ -3086,7 +3086,7 @@ nmp_cache_dirty_set_all_main(NMPCache *cache, const NMPLookup *lookup)
NMPCache *
nmp_cache_new(NMDedupMultiIndex *multi_idx, gboolean use_udev)
{
NMPCache *cache = g_slice_new0(NMPCache);
NMPCache *cache = nm_slice_new0(NMPCache);
guint i;
for (i = NMP_CACHE_ID_TYPE_NONE + 1; i <= NMP_CACHE_ID_TYPE_MAX; i++)
@ -3108,7 +3108,7 @@ nmp_cache_free(NMPCache *cache)
nm_dedup_multi_index_unref(cache->multi_idx);
g_slice_free(NMPCache, cache);
nm_slice_free_typed(NMPCache, cache);
}
/*****************************************************************************/

View file

@ -197,7 +197,7 @@ nm_udev_client_new(const char *const *subsystems,
NMUdevClient *self;
guint n;
self = g_slice_new0(NMUdevClient);
self = nm_slice_new0(NMUdevClient);
self->event_handler = event_handler;
self->event_user_data = event_user_data;
@ -259,7 +259,7 @@ nm_udev_client_destroy(NMUdevClient *self)
g_strfreev(self->subsystems);
g_slice_free(NMUdevClient, self);
nm_slice_free_typed(NMUdevClient, self);
return NULL;
}

View file

@ -577,7 +577,7 @@ create_request(NMPolkitListener *listener,
{
AuthRequest *request;
request = g_slice_new(AuthRequest);
request = nm_slice_new(AuthRequest);
*request = (AuthRequest){
.listener = listener,
.dbus_invocation = invocation,

View file

@ -84,7 +84,7 @@ _request_data_free(gpointer data)
g_object_unref(request->connection);
g_strfreev(request->hints);
g_slice_free(RequestData, request);
nm_slice_free_typed(RequestData, request);
}
static void
@ -140,7 +140,7 @@ _secret_real_free(NMSecretAgentSimpleSecret *secret)
g_free(real->property);
g_clear_object(&real->setting);
g_slice_free(SecretReal, real);
nm_slice_free_typed(SecretReal, real);
}
static NMSecretAgentSimpleSecret *
@ -163,7 +163,7 @@ _secret_real_new_plain(NMSecretAgentSecretType secret_type,
g_object_get(setting, property, &value, NULL);
real = g_slice_new(SecretReal);
real = nm_slice_new(SecretReal);
*real = (SecretReal){
.base.secret_type = secret_type,
.base.pretty_name = g_strdup(pretty_name),
@ -191,7 +191,7 @@ _secret_real_new_vpn_secret(const char *pretty_name,
value = nm_setting_vpn_get_secret(NM_SETTING_VPN(setting), property);
real = g_slice_new(SecretReal);
real = nm_slice_new(SecretReal);
*real = (SecretReal){
.base.secret_type = NM_SECRET_AGENT_SECRET_TYPE_VPN_SECRET,
.base.pretty_name = g_strdup(pretty_name),
@ -216,7 +216,7 @@ _secret_real_new_wireguard_peer_psk(NMSettingWireGuard *s_wg,
nm_assert(NM_IS_SETTING_WIREGUARD(s_wg));
nm_assert(public_key);
real = g_slice_new(SecretReal);
real = nm_slice_new(SecretReal);
*real = (SecretReal){
.base.secret_type = NM_SECRET_AGENT_SECRET_TYPE_WIREGUARD_PEER_PSK,
.base.pretty_name = g_strdup_printf(_("Preshared-key for %s"), public_key),
@ -538,7 +538,7 @@ _auth_dialog_data_free(AuthDialogData *data)
g_string_free(data->auth_dialog_response, TRUE);
g_object_unref(data->input_stream);
g_object_unref(data->output_stream);
g_slice_free(AuthDialogData, data);
nm_slice_free_typed(AuthDialogData, data);
}
static void
@ -808,7 +808,7 @@ try_spawn_vpn_auth_helper(RequestData *request, GPtrArray *secrets)
auth_dialog_request_len = auth_dialog_request->len;
auth_dialog_request_str = g_string_free(auth_dialog_request, FALSE);
data = g_slice_new(AuthDialogData);
data = nm_slice_new(AuthDialogData);
*data = (AuthDialogData){
.auth_dialog_response = g_string_new_len(NULL, sizeof(data->read_buf)),
.auth_dialog_pid = auth_dialog_pid,
@ -1062,7 +1062,7 @@ get_secrets(NMSecretAgentOld *agent,
request_id_setting_name = &request_id[strlen(request_id) - strlen(setting_name)];
nm_assert(nm_streq(request_id_setting_name, setting_name));
request = g_slice_new(RequestData);
request = nm_slice_new(RequestData);
*request = (RequestData){
.self = self,
.connection = g_object_ref(connection),

View file

@ -336,7 +336,7 @@ nmcs_utils_poll(int poll_timeout_ms,
{
PollTaskData *poll_task_data;
poll_task_data = g_slice_new(PollTaskData);
poll_task_data = nm_slice_new(PollTaskData);
*poll_task_data = (PollTaskData){
.task = nm_g_task_new(NULL, cancellable, nmcs_utils_poll, callback, user_data),
.probe_start_fcn = probe_start_fcn,

View file

@ -200,7 +200,7 @@ _ehandle_complete(EHandleData *edata, GError *error_take)
_ehandle_free_ehandle(edata);
get_result = g_slice_new(GetResult);
get_result = nm_slice_new(GetResult);
*get_result = (GetResult){
.response_code = response_code,
/* This ensures that response_data is always NUL terminated. This is an important guarantee
@ -278,7 +278,7 @@ nm_http_client_get(NMHttpClient *self,
priv = NM_HTTP_CLIENT_GET_PRIVATE(self);
edata = g_slice_new(EHandleData);
edata = nm_slice_new(EHandleData);
*edata = (EHandleData){
.task = nm_g_task_new(self, cancellable, nm_http_client_get, callback, user_data),
.recv_data = NM_STR_BUF_INIT(0, FALSE),
@ -538,7 +538,7 @@ nm_http_client_poll_get(NMHttpClient *self,
g_return_if_fail(ratelimit_timeout_ms >= -1);
g_return_if_fail(!cancellable || G_CANCELLABLE(cancellable));
poll_get_data = g_slice_new(PollGetData);
poll_get_data = nm_slice_new(PollGetData);
*poll_get_data = (PollGetData){
.task = nm_g_task_new(self, cancellable, nm_http_client_poll_get, callback, user_data),
.uri = g_strdup(uri),

View file

@ -477,7 +477,7 @@ _get_net_ifaces_list_cb(GObject *source, GAsyncResult *result, gpointer user_dat
if (intern_iface_idx < 0)
continue;
iface_data = g_slice_new(AzureIfaceData);
iface_data = nm_slice_new(AzureIfaceData);
*iface_data = (AzureIfaceData){
.get_config_data = get_config_data,
.iface_get_config = NULL,

View file

@ -374,7 +374,7 @@ _get_net_ifaces_list_cb(GObject *source, GAsyncResult *result, gpointer user_dat
if (intern_iface_idx < 0)
continue;
iface_data = g_slice_new(GCPIfaceData);
iface_data = nm_slice_new(GCPIfaceData);
*iface_data = (GCPIfaceData){
.get_config_data = get_config_data,
.iface_get_config = NULL,

View file

@ -184,7 +184,7 @@ nmcs_provider_get_config_iface_data_create(NMCSProviderGetConfigTaskData *get_co
nm_assert(get_config_data);
nm_assert(NMCS_IS_PROVIDER(get_config_data->self));
iface_data = g_slice_new(NMCSProviderGetConfigIfaceData);
iface_data = nm_slice_new(NMCSProviderGetConfigIfaceData);
*iface_data = (NMCSProviderGetConfigIfaceData){
.get_config_data = get_config_data,
.hwaddr = g_strdup(hwaddr),
@ -292,7 +292,7 @@ nmcs_provider_get_config(NMCSProvider *self,
_LOGD("get-config: starting");
get_config_data = g_slice_new(NMCSProviderGetConfigTaskData);
get_config_data = nm_slice_new(NMCSProviderGetConfigTaskData);
*get_config_data = (NMCSProviderGetConfigTaskData){
/* "self" is kept alive by "task". */
.self = self,

View file

@ -194,7 +194,7 @@ script_info_free(gpointer ptr)
g_free(info->script);
g_free(info->error);
g_slice_free(ScriptInfo, info);
nm_slice_free_typed(ScriptInfo, info);
}
static void
@ -208,7 +208,7 @@ request_free(Request *request)
g_strfreev(request->envp);
g_ptr_array_free(request->scripts, TRUE);
g_slice_free(Request, request);
nm_slice_free_typed(Request, request);
}
/*****************************************************************************/
@ -762,7 +762,7 @@ _handle_action(GDBusMethodInvocation *invocation, GVariant *parameters)
&vpn_ip6_config,
&debug);
request = g_slice_new0(Request);
request = nm_slice_new0(Request);
request->request_id = ++gl.request_id_counter;
request->debug = debug || gl.log_verbose;
request->context = invocation;
@ -791,7 +791,7 @@ _handle_action(GDBusMethodInvocation *invocation, GVariant *parameters)
for (iter = sorted_scripts; iter; iter = g_slist_next(iter)) {
ScriptInfo *s;
s = g_slice_new0(ScriptInfo);
s = nm_slice_new0(ScriptInfo);
s->request = request;
s->script = iter->data;
s->wait = script_must_wait(s->script);

View file

@ -48,7 +48,7 @@ reader_new(void)
{
Reader *reader;
reader = g_slice_new(Reader);
reader = nm_slice_new(Reader);
*reader = (Reader){
.hash = g_hash_table_new_full(nm_str_hash, g_str_equal, g_free, g_object_unref),
.explicit_ip_connections =

View file

@ -483,7 +483,7 @@ _pending_job_register_object(GlobalData *gl, GObject *obj)
if (nm_clear_g_source_inst(&gl->source_idle_timeout))
_LOGT("idle-timeout: suspend timeout for pending request");
idle_data = g_slice_new(PendingJobData);
idle_data = nm_slice_new(PendingJobData);
idle_data->gl = gl;
c_list_link_tail(&gl->pending_jobs_lst_head, &idle_data->pending_jobs_lst);

View file

@ -1007,14 +1007,14 @@ nmc_secret_redisplay(void)
rl_point = g_utf8_strlen(save_line_buffer, save_point) * subst_len;
rl_end = g_utf8_strlen(rl_line_buffer, -1) * subst_len;
rl_line_buffer = g_slice_alloc(rl_end + 1);
rl_line_buffer = nm_slice_alloc(rl_end + 1);
for (i = 0; i + subst_len <= rl_end; i += subst_len)
memcpy(&rl_line_buffer[i], subst, subst_len);
rl_line_buffer[i] = '\0';
rl_redisplay();
g_slice_free1(rl_end + 1, rl_line_buffer);
nm_slice_free_sized(rl_end + 1, rl_line_buffer);
rl_line_buffer = save_line_buffer;
rl_end = save_end;
rl_point = save_point;
@ -1387,7 +1387,7 @@ read_offline_connection(CmdCall *call)
CmdStdinData *data;
stream = g_unix_input_stream_new(STDIN_FILENO, TRUE);
data = g_slice_new(CmdStdinData);
data = nm_slice_new(CmdStdinData);
data->call = call;
data->str = g_string_new_len(NULL, sizeof(data->buf));
@ -1434,7 +1434,7 @@ call_cmd(NmCli *nmc, GTask *task, const NMCCommand *cmd, int argc, const char *c
}
nmc->should_wait++;
call = g_slice_new(CmdCall);
call = nm_slice_new(CmdCall);
*call = (CmdCall){
.cmd = cmd,
.argc = argc,
@ -1465,7 +1465,7 @@ call_cmd(NmCli *nmc, GTask *task, const NMCCommand *cmd, int argc, const char *c
nm_assert(nmc->client == NULL);
nmc->should_wait++;
call = g_slice_new(CmdCall);
call = nm_slice_new(CmdCall);
*call = (CmdCall){
.cmd = cmd,
.argc = argc,

View file

@ -112,7 +112,7 @@ _add_connection_info_new(NmCli *nmc, NMConnection *orig_connection, NMConnection
{
AddConnectionInfo *info;
info = g_slice_new(AddConnectionInfo);
info = nm_slice_new(AddConnectionInfo);
*info = (AddConnectionInfo){
.nmc = nmc,
.orig_id = orig_connection ? g_strdup(nm_connection_get_id(orig_connection)) : NULL,
@ -188,7 +188,7 @@ print_connection_done(GObject *source_object, GAsyncResult *res, gpointer user_d
}
g_free(print_conn_data->data);
g_slice_free(PrintConnData, print_conn_data);
nm_slice_free_typed(PrintConnData, print_conn_data);
nmc->should_wait--;
quit();
@ -222,7 +222,7 @@ nmc_print_connection_and_quit(NmCli *nmc, NMConnection *connection)
goto error;
stream = g_unix_output_stream_new(STDOUT_FILENO, FALSE);
print_conn_data = g_slice_new(PrintConnData);
print_conn_data = nm_slice_new(PrintConnData);
print_conn_data->data = g_key_file_to_data(keyfile, &print_conn_data->length, NULL);
print_conn_data->written = 0;
print_conn_data->nmc = nmc;
@ -526,7 +526,7 @@ _metagen_con_show_row_data_new_for_connection(NMRemoteConnection *connection,
{
MetagenConShowRowData *row_data;
row_data = g_slice_new0(MetagenConShowRowData);
row_data = nm_slice_new0(MetagenConShowRowData);
row_data->connection = g_object_ref(NM_CONNECTION(connection));
row_data->show_active_fields = show_active_fields;
return row_data;
@ -539,7 +539,7 @@ _metagen_con_show_row_data_new_for_active_connection(NMRemoteConnection *connect
{
MetagenConShowRowData *row_data;
row_data = g_slice_new0(MetagenConShowRowData);
row_data = nm_slice_new0(MetagenConShowRowData);
if (connection)
row_data->connection = g_object_ref(NM_CONNECTION(connection));
row_data->primary_active = g_object_ref(active);
@ -597,7 +597,7 @@ _metagen_con_show_row_data_destroy(gpointer data)
g_clear_object(&row_data->connection);
g_clear_object(&row_data->primary_active);
nm_clear_pointer(&row_data->all_active, g_ptr_array_unref);
g_slice_free(MetagenConShowRowData, row_data);
nm_slice_free_typed(MetagenConShowRowData, row_data);
}
static const char *
@ -3314,7 +3314,7 @@ connection_cb_info_finish(ConnectionCbInfo *info, gpointer obj)
g_signal_handlers_disconnect_by_func(info->nmc->client, connection_removed_cb, info);
g_slice_free(ConnectionCbInfo, info);
nm_slice_free_typed(ConnectionCbInfo, info);
quit();
}
@ -3444,7 +3444,7 @@ do_connection_down(const NMCCommand *cmd, NmCli *nmc, int argc, const char *cons
if (nmc->timeout > 0) {
nmc->should_wait++;
info = g_slice_new0(ConnectionCbInfo);
info = nm_slice_new0(ConnectionCbInfo);
info->nmc = nmc;
info->obj_list = g_ptr_array_sized_new(found_active_cons->len);
for (i = 0; i < found_active_cons->len; i++) {
@ -9367,7 +9367,7 @@ do_connection_delete(const NMCCommand *cmd, NmCli *nmc, int argc, const char *co
if (nmc->complete)
goto finish;
info = g_slice_new0(ConnectionCbInfo);
info = nm_slice_new0(ConnectionCbInfo);
info->nmc = nmc;
info->obj_list = g_ptr_array_sized_new(found_cons->len);
for (i = 0; i < found_cons->len; i++) {
@ -9961,7 +9961,7 @@ do_connection_migrate(const NMCCommand *cmd, NmCli *nmc, int argc, const char *c
}
}
info = g_slice_new0(ConnectionCbInfo);
info = nm_slice_new0(ConnectionCbInfo);
info->nmc = nmc;
info->obj_list = g_ptr_array_sized_new(found_cons->len);
for (i = 0; i < found_cons->len; i++) {

View file

@ -2083,7 +2083,7 @@ add_and_activate_info_new(NmCli *nmc,
{
AddAndActivateInfo *info;
info = g_slice_new(AddAndActivateInfo);
info = nm_slice_new(AddAndActivateInfo);
*info = (AddAndActivateInfo){
.nmc = nmc,
.device = g_object_ref(device),
@ -2407,7 +2407,7 @@ device_cb_info_finish(DeviceCbInfo *info, NMDevice *device)
g_signal_handlers_disconnect_by_func(info->nmc->client, device_removed_cb, info);
nm_clear_g_cancellable(&info->cancellable);
g_slice_free(DeviceCbInfo, info);
nm_slice_free_typed(DeviceCbInfo, info);
quit();
}
@ -2468,7 +2468,7 @@ do_device_reapply(const NMCCommand *cmd, NmCli *nmc, int argc, const char *const
nmc->nowait_flag = (nmc->timeout == 0);
nmc->should_wait++;
info = g_slice_new0(DeviceCbInfo);
info = nm_slice_new0(DeviceCbInfo);
info->nmc = nmc;
info->queue = g_ptr_array_new_with_free_func(destroy_queue_element);
@ -2588,7 +2588,7 @@ do_device_modify(const NMCCommand *cmd, NmCli *nmc, int argc, const char *const
nmc->nowait_flag = (nmc->timeout == 0);
nmc->should_wait++;
info = g_slice_new(ModifyInfo);
info = nm_slice_new(ModifyInfo);
*info = (ModifyInfo){
.nmc = nmc,
.argc = argc,
@ -2658,7 +2658,7 @@ do_devices_disconnect(const NMCCommand *cmd, NmCli *nmc, int argc, const char *c
if (nmc->complete)
return;
info = g_slice_new0(DeviceCbInfo);
info = nm_slice_new0(DeviceCbInfo);
info->queue = g_steal_pointer(&queue);
info->nmc = nmc;
info->cmd_disconnect = TRUE;
@ -2725,7 +2725,7 @@ do_devices_delete(const NMCCommand *cmd, NmCli *nmc, int argc, const char *const
if (nmc->complete)
return;
info = g_slice_new0(DeviceCbInfo);
info = nm_slice_new0(DeviceCbInfo);
info->queue = g_steal_pointer(&queue);
info->nmc = nmc;
if (nmc->timeout > 0)
@ -3481,7 +3481,7 @@ do_device_wifi_list(const NMCCommand *cmd, NmCli *nmc, int argc, const char *con
return;
}
scan_info = g_slice_new(ScanInfo);
scan_info = nm_slice_new(ScanInfo);
*scan_info = (ScanInfo){
.out_indices = g_array_ref(out_indices),
.tmpl = tmpl,
@ -3503,7 +3503,7 @@ do_device_wifi_list(const NMCCommand *cmd, NmCli *nmc, int argc, const char *con
else
timeout_msec = 15000;
wifi_list_data = g_slice_new(WifiListData);
wifi_list_data = nm_slice_new(WifiListData);
*wifi_list_data = (WifiListData){
.wifi = wifi,
.scan_info = scan_info,
@ -5039,7 +5039,7 @@ free_checkpoint_info(CheckpointCbInfo *info)
{
g_clear_object(&info->checkpoint);
g_strfreev(info->argv);
g_slice_free(CheckpointCbInfo, info);
nm_slice_free_typed(CheckpointCbInfo, info);
}
static void
@ -5215,7 +5215,7 @@ do_device_checkpoint(const NMCCommand *cmd, NmCli *nmc, int argc, const char *co
if (nmc->complete)
return;
info = g_slice_new0(CheckpointCbInfo);
info = nm_slice_new0(CheckpointCbInfo);
info->nmc = nmc;
info->argv = nm_strv_dup(argv, argc, TRUE);

View file

@ -1067,7 +1067,7 @@ wireless_security_target_destroyed(gpointer user_data, GObject *ex_target)
g_free(binding->target_property);
g_slice_free(NMEditorWirelessSecurityMethodBinding, binding);
nm_slice_free_typed(NMEditorWirelessSecurityMethodBinding, binding);
}
/**
@ -1101,7 +1101,7 @@ nm_editor_bind_wireless_security_method(NMConnection *connection,
NMEditorWirelessSecurityMethodBinding *binding;
char *notify;
binding = g_slice_new0(NMEditorWirelessSecurityMethodBinding);
binding = nm_slice_new0(NMEditorWirelessSecurityMethodBinding);
binding->target = target;
binding->target_property = g_strdup(target_property);
@ -1224,7 +1224,7 @@ wep_key_target_destroyed(gpointer user_data, GObject *ex_target)
g_free(binding->entry_property);
g_free(binding->key_selector_property);
g_slice_free(NMEditorWepKeyBinding, binding);
nm_slice_free_typed(NMEditorWepKeyBinding, binding);
}
/**
@ -1253,7 +1253,7 @@ nm_editor_bind_wireless_security_wep_key(NMSettingWirelessSecurity *s_wsec,
NMEditorWepKeyBinding *binding;
char *notify;
binding = g_slice_new0(NMEditorWepKeyBinding);
binding = nm_slice_new0(NMEditorWepKeyBinding);
binding->s_wsec = g_object_ref(s_wsec);
binding->entry = entry;
binding->entry_property = g_strdup(entry_property);
@ -1389,7 +1389,7 @@ vlan_target_destroyed(gpointer user_data, GObject *ex_target)
NMEditorVlanWidgetBinding *binding = user_data;
g_free(binding->last_ifname_parent);
g_slice_free(NMEditorVlanWidgetBinding, binding);
nm_slice_free_typed(NMEditorVlanWidgetBinding, binding);
}
/**
@ -1408,7 +1408,7 @@ nm_editor_bind_vlan_name(NMSettingVlan *s_vlan, NMSettingConnection *s_con)
NMEditorVlanWidgetBinding *binding;
const char *ifname;
binding = g_slice_new0(NMEditorVlanWidgetBinding);
binding = nm_slice_new0(NMEditorVlanWidgetBinding);
binding->s_vlan = s_vlan;
binding->s_con = s_con;

View file

@ -78,7 +78,7 @@ nmt_connect_connection_free(NmtConnectConnection *nmtconn)
g_clear_object(&nmtconn->ap);
g_clear_object(&nmtconn->active);
g_free(nmtconn->ssid);
g_slice_free(NmtConnectConnection, nmtconn);
nm_slice_free_typed(NmtConnectConnection, nmtconn);
}
static void
@ -88,7 +88,7 @@ nmt_connect_device_free(NmtConnectDevice *nmtdev)
g_clear_object(&nmtdev->device);
g_slist_free_full(nmtdev->conns, (GDestroyNotify) nmt_connect_connection_free);
g_slice_free(NmtConnectDevice, nmtdev);
nm_slice_free_typed(NmtConnectDevice, nmtdev);
}
static const char *device_sort_order[] = {"NMDeviceEthernet",
@ -188,7 +188,7 @@ add_connections_for_device(NmtConnectDevice *nmtdev, const GPtrArray *connection
continue;
if (nm_device_connection_valid(nmtdev->device, conn)) {
NmtConnectConnection *nmtconn = g_slice_new0(NmtConnectConnection);
NmtConnectConnection *nmtconn = nm_slice_new0(NmtConnectConnection);
nmtconn->name = nm_connection_get_id(conn);
nmtconn->device = nmtdev->device;
@ -275,7 +275,7 @@ add_connections_for_aps(NmtConnectDevice *nmtdev, const GPtrArray *connections)
}
g_hash_table_add(seen_ssids, ap_hash);
nmtconn = g_slice_new0(NmtConnectConnection);
nmtconn = nm_slice_new0(NmtConnectConnection);
nmtconn->device = nmtdev->device;
nmtconn->ap = g_object_ref(ap);
ssid = nm_access_point_get_ssid(ap);
@ -319,7 +319,7 @@ append_nmt_devices_for_devices(GSList *nmt_devices,
if (sort_order == -1)
continue;
nmtdev = g_slice_new0(NmtConnectDevice);
nmtdev = nm_slice_new0(NmtConnectDevice);
nmtdev->name = g_strdup(names[i]);
nmtdev->device = g_object_ref(device);
nmtdev->sort_order = sort_order;
@ -361,7 +361,7 @@ append_nmt_devices_for_virtual_devices(GSList *nmt_devices, const GPtrArray *con
if (nmtdev)
g_free(name);
else {
nmtdev = g_slice_new0(NmtConnectDevice);
nmtdev = nm_slice_new0(NmtConnectDevice);
nmtdev->name = name ?: g_strdup("Unknown");
nmtdev->sort_order = sort_order;
@ -369,7 +369,7 @@ append_nmt_devices_for_virtual_devices(GSList *nmt_devices, const GPtrArray *con
nmt_devices = g_slist_prepend(nmt_devices, nmtdev);
}
nmtconn = g_slice_new0(NmtConnectConnection);
nmtconn = nm_slice_new0(NmtConnectConnection);
nmtconn->name = nm_connection_get_id(conn);
nmtconn->conn = g_object_ref(conn);
@ -388,7 +388,7 @@ append_nmt_devices_for_vpns(GSList *nmt_devices, const GPtrArray *connections)
NMConnection *conn;
NmtConnectConnection *nmtconn;
nmtdev = g_slice_new0(NmtConnectDevice);
nmtdev = nm_slice_new0(NmtConnectDevice);
nmtdev->name = g_strdup(_("VPN"));
nmtdev->sort_order = 100;
@ -397,7 +397,7 @@ append_nmt_devices_for_vpns(GSList *nmt_devices, const GPtrArray *connections)
if (!nm_connection_is_type(conn, NM_SETTING_VPN_SETTING_NAME))
continue;
nmtconn = g_slice_new0(NmtConnectConnection);
nmtconn = nm_slice_new0(NmtConnectConnection);
nmtconn->name = nm_connection_get_id(conn);
nmtconn->conn = g_object_ref(conn);

View file

@ -74,8 +74,8 @@
Memcheck:Leak
fun:malloc
fun:g_malloc
fun:g_slice_alloc
fun:g_slice_alloc0
fun:nm_slice_alloc
fun:nm_slice_alloc0
fun:g_type_create_instance
fun:g_object_constructor
...
@ -175,7 +175,7 @@
match-leak-kinds: definite
fun:malloc
fun:g_malloc
fun:g_slice_alloc
fun:nm_slice_alloc
fun:g_variant_new_from_bytes
fun:g_variant_new_from_trusted
fun:parse_dhcp
@ -192,8 +192,8 @@
match-leak-kinds: definite
fun:malloc
fun:g_malloc
fun:g_slice_alloc
fun:g_slice_alloc0
fun:nm_slice_alloc
fun:nm_slice_alloc0
fun:get_dispatch
fun:g_main_context_dispatch
...
@ -210,8 +210,8 @@
match-leak-kinds: definite
fun:malloc
fun:g_malloc
fun:g_slice_alloc
fun:g_slice_alloc0
fun:nm_slice_alloc
fun:nm_slice_alloc0
fun:g_main_context_push_thread_default
fun:gdbus_shared_thread_func
fun:g_thread_proxy
@ -245,8 +245,8 @@
fun:calloc
fun:g_malloc0
...
fun:g_slice_alloc
fun:g_slice_alloc0
fun:nm_slice_alloc
fun:nm_slice_alloc0
fun:g_main_context_push_thread_default
fun:gdbus_shared_thread_func
fun:g_thread_proxy
@ -269,8 +269,8 @@
match-leak-kinds: definite
fun:malloc
fun:g_malloc
fun:g_slice_alloc
fun:g_slice_alloc0
fun:nm_slice_alloc
fun:nm_slice_alloc0
fun:get_dispatch
fun:g_main_current_source
fun:g_task_return
@ -287,8 +287,8 @@
match-leak-kinds: definite
fun:malloc
fun:g_malloc
fun:g_slice_alloc
fun:g_slice_alloc0
fun:nm_slice_alloc
fun:nm_slice_alloc0
fun:g_system_thread_new
fun:g_thread_new_internal
...
@ -307,8 +307,8 @@
fun:calloc
fun:g_malloc0
...
fun:g_slice_alloc
fun:g_slice_alloc0
fun:nm_slice_alloc
fun:nm_slice_alloc0
fun:get_dispatch
fun:g_main_current_source
fun:g_task_return
@ -324,7 +324,7 @@
match-leak-kinds: definite
fun:malloc
fun:g_malloc
fun:g_slice_alloc
fun:nm_slice_alloc
fun:g_error_new_valist
fun:g_error_new
fun:g_dbus_error_new_for_dbus_error
@ -342,7 +342,7 @@
match-leak-kinds: definite
fun:malloc
fun:g_malloc
fun:g_slice_alloc
fun:nm_slice_alloc
fun:g_hash_table_new_full
fun:demarshal_map
fun:_dbus_gvalue_demarshal
@ -375,8 +375,8 @@
fun:calloc
fun:g_malloc0
fun:thread_memory_from_self
fun:g_slice_alloc
fun:g_slice_alloc0
fun:nm_slice_alloc
fun:nm_slice_alloc0
fun:g_main_context_push_thread_default
fun:gdbus_shared_thread_func
fun:g_thread_proxy
@ -390,8 +390,8 @@
match-leak-kinds: definite
fun:malloc
fun:g_malloc
fun:g_slice_alloc
fun:g_slice_alloc0
fun:nm_slice_alloc
fun:nm_slice_alloc0
fun:get_dispatch
fun:g_main_dispatch
fun:g_main_context_dispatch
@ -419,8 +419,8 @@
match-leak-kinds: definite
fun:malloc
fun:g_malloc
fun:g_slice_alloc
fun:g_slice_alloc0
fun:nm_slice_alloc
fun:nm_slice_alloc0
fun:g_type_create_instance
fun:g_object_new_internal
fun:g_object_new*
@ -446,8 +446,8 @@
match-leak-kinds: definite
fun:malloc
fun:g_malloc
fun:g_slice_alloc
fun:g_slice_alloc0
fun:nm_slice_alloc
fun:nm_slice_alloc0
fun:g_system_thread_new
fun:g_thread_new_internal
fun:g_thread_new
@ -478,8 +478,8 @@
match-leak-kinds: definite
fun:malloc
fun:g_malloc
fun:g_slice_alloc
fun:g_slice_alloc0
fun:nm_slice_alloc
fun:nm_slice_alloc0
fun:g_system_thread_new
fun:g_thread_new_internal
fun:g_thread_pool_start_thread.part.1