From 676ea569bbe5abf750d9ed516f35c017efbdce5f Mon Sep 17 00:00:00 2001 From: Varsha Rao Date: Wed, 20 Sep 2017 21:53:08 +0530 Subject: 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 --- include/utils.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'include') 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); -- cgit v1.2.3