projects
/
oweals
/
libubox.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
5129bc9
)
add blobmsg_for_each_attr
author
Felix Fietkau
<nbd@openwrt.org>
Sat, 29 Jan 2011 17:16:12 +0000
(18:16 +0100)
committer
Felix Fietkau
<nbd@openwrt.org>
Sat, 29 Jan 2011 17:16:12 +0000
(18:16 +0100)
blobmsg.h
patch
|
blob
|
history
diff --git
a/blobmsg.h
b/blobmsg.h
index 95732e31a07a53971b8425d4815671848e0a0356..aa1f314a9db884bee1b0d50c94bba95664e4af0d 100644
(file)
--- 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