diff options
author | Felix Fietkau <nbd@nbd.name> | 2022-11-23 12:29:19 +0100 |
---|---|---|
committer | Felix Fietkau <nbd@nbd.name> | 2022-11-23 12:30:10 +0100 |
commit | b09b316aeaf6282bf2d2f7df9d2cc2cdf3977691 (patch) | |
tree | 15e4abbe6391b6b6861c99da2f46f75046bde314 | |
parent | ea56013409d5823001b47a9bba6f74055a6d76a5 (diff) | |
download | libubox-b09b316aeaf6282bf2d2f7df9d2cc2cdf3977691.tar.gz |
blobmsg: add blobmsg_parse_attr function
This allows turning the common pattern of:
blobmsg_parse(policy, ARRAY_SIZE(policy), tb, blobmsg_data(data), blobmsg_len(data));
into:
blobmsg_parse_attr(policy, ARRAY_SIZE(policy), tb, data);
Signed-off-by: Felix Fietkau <nbd@nbd.name>
-rw-r--r-- | blobmsg.h | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -179,6 +179,13 @@ int blobmsg_add_field(struct blob_buf *buf, int type, const char *name, const void *data, unsigned int len); static inline int +blobmsg_parse_attr(const struct blobmsg_policy *policy, int policy_len, + struct blob_attr **tb, struct blob_attr *data) +{ + return blobmsg_parse(policy, policy_len, tb, blobmsg_data(data), blobmsg_len(data)); +} + +static inline int blobmsg_add_double(struct blob_buf *buf, const char *name, double val) { union { |