From 5fd4ca8a5b1d8fca842559134b7d005de655f2e1 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Sun, 15 Jul 2018 14:18:56 +0200 Subject: [PATCH] platform/netlink: drop nlmsg_alloc_inherit() function It's only used internally, and it seems not very useful to have. As it is confusing to have multiple functions for doing something similar, drop it -- since it's not really used. I also cannot imagine a good use-case for it. --- src/platform/nm-netlink.c | 33 +++++++-------------------------- src/platform/nm-netlink.h | 2 -- 2 files changed, 7 insertions(+), 28 deletions(-) diff --git a/src/platform/nm-netlink.c b/src/platform/nm-netlink.c index 5ca7bb406c..c057acd9a1 100644 --- a/src/platform/nm-netlink.c +++ b/src/platform/nm-netlink.c @@ -331,27 +331,6 @@ nlmsg_alloc (void) return nlmsg_alloc_size (get_default_page_size ()); } -/** - * Allocate a new netlink message with maximum payload size specified. - */ -struct nl_msg * -nlmsg_alloc_inherit (struct nlmsghdr *hdr) -{ - struct nl_msg *nm; - - nm = nlmsg_alloc (); - if (hdr) { - struct nlmsghdr *new = nm->nm_nlh; - - new->nlmsg_type = hdr->nlmsg_type; - new->nlmsg_flags = hdr->nlmsg_flags; - new->nlmsg_seq = hdr->nlmsg_seq; - new->nlmsg_pid = hdr->nlmsg_pid; - } - - return nm; -} - struct nl_msg * nlmsg_alloc_convert (struct nlmsghdr *hdr) { @@ -365,12 +344,14 @@ nlmsg_alloc_convert (struct nlmsghdr *hdr) struct nl_msg * nlmsg_alloc_simple (int nlmsgtype, int flags) { - struct nlmsghdr nlh = { - .nlmsg_type = nlmsgtype, - .nlmsg_flags = flags, - }; + struct nl_msg *nm; + struct nlmsghdr *new; - return nlmsg_alloc_inherit (&nlh); + nm = nlmsg_alloc (); + new = nm->nm_nlh; + new->nlmsg_type = nlmsgtype; + new->nlmsg_flags = flags; + return nm; } int diff --git a/src/platform/nm-netlink.h b/src/platform/nm-netlink.h index e20388e200..187685d824 100644 --- a/src/platform/nm-netlink.h +++ b/src/platform/nm-netlink.h @@ -314,8 +314,6 @@ struct nl_msg *nlmsg_alloc (void); struct nl_msg *nlmsg_alloc_size (size_t max); -struct nl_msg *nlmsg_alloc_inherit (struct nlmsghdr *hdr); - struct nl_msg *nlmsg_alloc_convert (struct nlmsghdr *hdr); struct nl_msg *nlmsg_alloc_simple (int nlmsgtype, int flags);