diff options
author | Thomas Graf <tgraf@suug.ch> | 2010-11-23 12:29:45 (GMT) |
---|---|---|
committer | Thomas Graf <tgraf@suug.ch> | 2010-11-23 12:29:45 (GMT) |
commit | 9513d4ce34a9e2c78645eabe35f564facfc1db1f (patch) | |
tree | 78f53c3dfe79abd7bb155b97accee08ab22d7545 /include | |
parent | 4fb528bbaf59d6c0a90daf203f764cd181801e89 (diff) | |
download | libnl-9513d4ce34a9e2c78645eabe35f564facfc1db1f.zip libnl-9513d4ce34a9e2c78645eabe35f564facfc1db1f.tar.gz libnl-9513d4ce34a9e2c78645eabe35f564facfc1db1f.tar.bz2 |
Rename nlmsg_for_each_msg() to nlmsg_for_each()
Also put remaining variable on local stack instead of requiring the user
to supply it. Old interface is kept for compatibility.
Diffstat (limited to 'include')
-rw-r--r-- | include/netlink/msg.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/include/netlink/msg.h b/include/netlink/msg.h index 12b2061..ef805a4 100644 --- a/include/netlink/msg.h +++ b/include/netlink/msg.h @@ -126,12 +126,14 @@ extern void nl_msg_dump(struct nl_msg *, FILE *); * @arg pos loop counter, set to current message * @arg head head of message stream * @arg len length of message stream - * @arg rem initialized to len, holds bytes currently remaining in stream */ +#define nlmsg_for_each(pos, head, len) \ + for (int rem = len, pos = head; \ + nlmsg_ok(pos, rem); \ + pos = nlmsg_next(pos, &rem)) + #define nlmsg_for_each_msg(pos, head, len, rem) \ - for (pos = head, rem = len; \ - nlmsg_ok(pos, rem); \ - pos = nlmsg_next(pos, &(rem))) + nlmsg_for_each(pos, head, len) /** @} */ |