diff options
author | Thomas Haller <thaller@redhat.com> | 2017-10-09 11:46:44 (GMT) |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2017-10-09 11:51:29 (GMT) |
commit | b4802a17a7655bfeee3e9c06e649d30b96dbad3b (patch) | |
tree | 8a70c993fc2d929f51b2ab64119900ecbd0e8737 /lib/msg.c | |
parent | 3fe3454b0228a6c9729ce9ffebf62bda85fd87ab (diff) | |
download | libnl-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.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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; |