mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-03 12:50:17 +01:00
platform/netlink: use designated initializer in nlmsg_alloc_size()
This commit is contained in:
parent
f7df8fda1a
commit
5044c33ead
1 changed files with 8 additions and 6 deletions
|
|
@ -259,11 +259,12 @@ nlmsg_alloc_size (size_t len)
|
|||
if (len < sizeof (struct nlmsghdr))
|
||||
len = sizeof (struct nlmsghdr);
|
||||
|
||||
nm = g_slice_new0 (struct nl_msg);
|
||||
|
||||
nm->nm_protocol = -1;
|
||||
nm->nm_size = len;
|
||||
nm->nm_nlh = g_malloc0 (len);
|
||||
nm = g_slice_new (struct nl_msg);
|
||||
*nm = (struct nl_msg) {
|
||||
.nm_protocol = -1,
|
||||
.nm_size = len,
|
||||
.nm_nlh = g_malloc0 (len),
|
||||
};
|
||||
nm->nm_nlh->nlmsg_len = nlmsg_total_size (0);
|
||||
return nm;
|
||||
}
|
||||
|
|
@ -370,7 +371,8 @@ nla_get_u64 (const struct nlattr *nla)
|
|||
{
|
||||
uint64_t tmp = 0;
|
||||
|
||||
if (nla && nla_len (nla) >= sizeof (tmp))
|
||||
if ( nla
|
||||
&& nla_len (nla) >= sizeof (tmp))
|
||||
memcpy (&tmp, nla_data (nla), sizeof (tmp));
|
||||
|
||||
return tmp;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue