diff options
author | Felix Fietkau <nbd@openwrt.org> | 2011-01-29 20:16:12 +0300 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2011-01-29 20:16:12 +0300 |
commit | 2d9f917d000025eaebcccf9fca758aa8b9a4763c (patch) | |
tree | b49944b7fe52fcecb04f708377e70c6d2eea64a5 /blobmsg.h | |
parent | 5129bc940168d080e9b3aa63ae0f92a531455b0e (diff) |
add blobmsg_for_each_attr
Diffstat (limited to 'blobmsg.h')
-rw-r--r-- | blobmsg.h | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -141,4 +141,10 @@ static inline int blobmsg_buf_init(struct blob_buf *buf) char *blobmsg_format_json(struct blob_attr *attr); +#define blobmsg_for_each_attr(pos, attr, rem) \ + for (rem = blobmsg_data_len(attr), pos = blobmsg_data(attr); \ + (blob_pad_len(pos) <= rem) && \ + (blob_pad_len(pos) >= sizeof(struct blob_attr)); \ + rem -= blob_pad_len(pos), pos = blob_next(pos)) + #endif |