diff options
author | Varsha Rao <rvarsha016@gmail.com> | 2017-09-20 21:53:08 +0530 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2017-09-27 14:00:13 +0200 |
commit | 676ea569bbe5abf750d9ed516f35c017efbdce5f (patch) | |
tree | c348c3f834009ef5edb881311b20f26a46b40307 /include/utils.h | |
parent | b808caea50a9de10530591b2e83c243d9fbf4855 (diff) |
src: Change parameters of SNPRINTF_BUFFER_SIZE macro.
SNPRINTF_BUFFER_SIZE() macro declaration and definition is changed so
that it accepts three arguments ret, remain and offset. Parameters size
and len are not required instead parameter remain keeps track of
available space in the buffer.
Signed-off-by: Varsha Rao <rvarsha016@gmail.com>
Diffstat (limited to 'include/utils.h')
-rw-r--r-- | include/utils.h | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/include/utils.h b/include/utils.h index 2f5cf34..3cc6596 100644 --- a/include/utils.h +++ b/include/utils.h @@ -50,14 +50,13 @@ void __nftnl_assert_attr_exists(uint16_t attr, uint16_t attr_max, __nftnl_assert_attr_exists(_attr, _attr_max, __FILE__, __LINE__); \ }) -#define SNPRINTF_BUFFER_SIZE(ret, size, len, offset) \ +#define SNPRINTF_BUFFER_SIZE(ret, remain, offset) \ if (ret < 0) \ ret = 0; \ offset += ret; \ - if (ret > len) \ - ret = len; \ - size += ret; \ - len -= ret; + if (ret > remain) \ + ret = remain; \ + remain -= ret; \ const char *nftnl_family2str(uint32_t family); int nftnl_str2family(const char *family); |