Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.openwrt.org/project/libubox.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'blobmsg.h')
-rw-r--r--blobmsg.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/blobmsg.h b/blobmsg.h
index 95732e3..aa1f314 100644
--- a/blobmsg.h
+++ b/blobmsg.h
@@ -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