zebra: always define ROUNDUP and ROUND_TYPE

Move the declaration of ROUNDUP and ROUND_TYPE to outside of
`ifdef SA_SIZE`. We'll use these definitions in the next commit.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
This commit is contained in:
Rafael Zalamena 2018-12-05 11:50:25 -02:00
parent ad31e8d398
commit cb800e3529

View File

@ -64,17 +64,18 @@ extern struct zebra_privs_t zserv_privs;
* 0). We follow this practice without questioning it, but it is a * 0). We follow this practice without questioning it, but it is a
* bug if quagga calls ROUNDUP with 0. * bug if quagga calls ROUNDUP with 0.
*/ */
#ifdef __APPLE__
#define ROUNDUP_TYPE int
#else
#define ROUNDUP_TYPE long
#endif
/* /*
* Because of these varying conventions, the only sane approach is for * Because of these varying conventions, the only sane approach is for
* the <net/route.h> header to define some flavor of ROUNDUP macro. * the <net/route.h> header to define some flavor of ROUNDUP macro.
*/ */
#if defined(SA_SIZE) /* OS X (Xcode as of 2014-12) is known not to define RT_ROUNDUP */
/* SAROUNDUP is the only thing we need, and SA_SIZE provides that */
#define SAROUNDUP(a) SA_SIZE(a)
#else /* !SA_SIZE */
#if defined(RT_ROUNDUP) #if defined(RT_ROUNDUP)
#define ROUNDUP(a) RT_ROUNDUP(a) #define ROUNDUP(a) RT_ROUNDUP(a)
#endif /* defined(RT_ROUNDUP) */ #endif /* defined(RT_ROUNDUP) */
@ -96,20 +97,17 @@ extern struct zebra_privs_t zserv_privs;
* have it in its headers, this will break rather obviously and you'll * have it in its headers, this will break rather obviously and you'll
* have to fix it here. * have to fix it here.
*/ */
/* OS X (Xcode as of 2014-12) is known not to define RT_ROUNDUP */
#ifdef __APPLE__
#define ROUNDUP_TYPE int
#else
#define ROUNDUP_TYPE long
#endif
#define ROUNDUP(a) \ #define ROUNDUP(a) \
((a) > 0 ? (1 + (((a)-1) | (sizeof(ROUNDUP_TYPE) - 1))) \ ((a) > 0 ? (1 + (((a)-1) | (sizeof(ROUNDUP_TYPE) - 1))) \
: sizeof(ROUNDUP_TYPE)) : sizeof(ROUNDUP_TYPE))
#endif /* defined(ROUNDUP) */ #endif /* defined(ROUNDUP) */
#if defined(SA_SIZE)
/* SAROUNDUP is the only thing we need, and SA_SIZE provides that */
#define SAROUNDUP(a) SA_SIZE(a)
#else /* !SA_SIZE */
/* /*
* Given a pointer (sockaddr or void *), return the number of bytes * Given a pointer (sockaddr or void *), return the number of bytes
* taken up by the sockaddr and any padding needed for alignment. * taken up by the sockaddr and any padding needed for alignment.