mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-08 07:37:29 +00:00
tools: add more macros to cocci.h
Coccinelle needs to know about complicated macros to understand certain code paths, add some more macros there. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
This commit is contained in:
parent
e4195c02a7
commit
3f0cc3ffb3
@ -27,3 +27,62 @@
|
|||||||
struct type *le_next; /* next element */ \
|
struct type *le_next; /* next element */ \
|
||||||
struct type **le_prev; /* address of previous next element */ \
|
struct type **le_prev; /* address of previous next element */ \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define STREAM_GETC(S, P) \
|
||||||
|
do { \
|
||||||
|
uint8_t _pval; \
|
||||||
|
if (!stream_getc2((S), &_pval)) \
|
||||||
|
goto stream_failure; \
|
||||||
|
(P) = _pval; \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define STREAM_GETW(S, P) \
|
||||||
|
do { \
|
||||||
|
uint16_t _pval; \
|
||||||
|
if (!stream_getw2((S), &_pval)) \
|
||||||
|
goto stream_failure; \
|
||||||
|
(P) = _pval; \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define STREAM_GETL(S, P) \
|
||||||
|
do { \
|
||||||
|
uint32_t _pval; \
|
||||||
|
if (!stream_getl2((S), &_pval)) \
|
||||||
|
goto stream_failure; \
|
||||||
|
(P) = _pval; \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define STREAM_GETF(S, P) \
|
||||||
|
do { \
|
||||||
|
union { \
|
||||||
|
float r; \
|
||||||
|
uint32_t d; \
|
||||||
|
} _pval; \
|
||||||
|
if (stream_getl2((S), &_pval.d)) \
|
||||||
|
goto stream_failure; \
|
||||||
|
(P) = _pval.r; \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define STREAM_GETQ(S, P) \
|
||||||
|
do { \
|
||||||
|
uint64_t _pval; \
|
||||||
|
if (!stream_getq2((S), &_pval)) \
|
||||||
|
goto stream_failure; \
|
||||||
|
(P) = _pval; \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define STREAM_GET(P, STR, SIZE) \
|
||||||
|
do { \
|
||||||
|
if (!stream_get2((P), (STR), (SIZE))) \
|
||||||
|
goto stream_failure; \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define AF_FOREACH(af) for ((af) = BGP_AF_START; (af) < BGP_AF_MAX; (af)++)
|
||||||
|
|
||||||
|
#define FOREACH_AFI_SAFI(afi, safi) \
|
||||||
|
\
|
||||||
|
for (afi = AFI_IP; afi < AFI_MAX; afi++) \
|
||||||
|
for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++)
|
||||||
|
|
||||||
|
#define FOREACH_SAFI(safi) for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user