summaryrefslogtreecommitdiffstats
path: root/lib/msg.c
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2017-10-09 11:46:44 (GMT)
committerThomas Haller <thaller@redhat.com>2017-10-09 11:51:29 (GMT)
commitb4802a17a7655bfeee3e9c06e649d30b96dbad3b (patch)
tree8a70c993fc2d929f51b2ab64119900ecbd0e8737 /lib/msg.c
parent3fe3454b0228a6c9729ce9ffebf62bda85fd87ab (diff)
downloadlibnl-b4802a17a7655bfeee3e9c06e649d30b96dbad3b.zip
libnl-b4802a17a7655bfeee3e9c06e649d30b96dbad3b.tar.gz
libnl-b4802a17a7655bfeee3e9c06e649d30b96dbad3b.tar.bz2
nl: add "const" specifier for nla_policy argument of parse functions
Adding const to a function argument is generally not an API break (at least, if the argument is a struct, like in this case). Usually we declare the policy as static variables. The user should be able to mark them as "const", so that the linker makes the policy array read-only. Adjust the API to allow for that. Signed-off-by: Thomas Haller <thaller@redhat.com>
Diffstat (limited to 'lib/msg.c')
-rw-r--r--lib/msg.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/msg.c b/lib/msg.c
index 3e27d4e..0a52340 100644
--- a/lib/msg.c
+++ b/lib/msg.c
@@ -212,7 +212,7 @@ struct nlmsghdr *nlmsg_next(struct nlmsghdr *nlh, int *remaining)
* See nla_parse()
*/
int nlmsg_parse(struct nlmsghdr *nlh, int hdrlen, struct nlattr *tb[],
- int maxtype, struct nla_policy *policy)
+ int maxtype, const struct nla_policy *policy)
{
if (!nlmsg_valid_hdr(nlh, hdrlen))
return -NLE_MSG_TOOSHORT;
@@ -243,7 +243,7 @@ struct nlattr *nlmsg_find_attr(struct nlmsghdr *nlh, int hdrlen, int attrtype)
* @arg policy validation policy
*/
int nlmsg_validate(struct nlmsghdr *nlh, int hdrlen, int maxtype,
- struct nla_policy *policy)
+ const struct nla_policy *policy)
{
if (!nlmsg_valid_hdr(nlh, hdrlen))
return -NLE_MSG_TOOSHORT;