mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-14 08:50:26 +00:00
lib: rename prefixtype
to uniontype
About to use this for sockunion, which is not a prefix. `uniontype` makes more sense, the macros are for defining transparent unions after all. (clang-format off thrown in as it otherwise wrecks formatting.) Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
This commit is contained in:
parent
4bdba57861
commit
19cbc31579
@ -424,10 +424,10 @@ _Static_assert(sizeof(_uint64_t) == 8 && sizeof(_int64_t) == 8,
|
|||||||
* type.)
|
* type.)
|
||||||
*/
|
*/
|
||||||
#ifndef __cplusplus
|
#ifndef __cplusplus
|
||||||
#define prefixtype(uname, typename, fieldname) typename *fieldname;
|
#define uniontype(uname, typename, fieldname) typename *fieldname;
|
||||||
#define TRANSPARENT_UNION __attribute__((transparent_union))
|
#define TRANSPARENT_UNION __attribute__((transparent_union))
|
||||||
#else
|
#else
|
||||||
#define prefixtype(uname, typename, fieldname) \
|
#define uniontype(uname, typename, fieldname) \
|
||||||
typename *fieldname; \
|
typename *fieldname; \
|
||||||
uname(typename *x) \
|
uname(typename *x) \
|
||||||
{ \
|
{ \
|
||||||
|
26
lib/prefix.h
26
lib/prefix.h
@ -286,23 +286,25 @@ struct prefix_sg {
|
|||||||
struct in_addr grp;
|
struct in_addr grp;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* clang-format off */
|
||||||
union prefixptr {
|
union prefixptr {
|
||||||
prefixtype(prefixptr, struct prefix, p)
|
uniontype(prefixptr, struct prefix, p)
|
||||||
prefixtype(prefixptr, struct prefix_ipv4, p4)
|
uniontype(prefixptr, struct prefix_ipv4, p4)
|
||||||
prefixtype(prefixptr, struct prefix_ipv6, p6)
|
uniontype(prefixptr, struct prefix_ipv6, p6)
|
||||||
prefixtype(prefixptr, struct prefix_evpn, evp)
|
uniontype(prefixptr, struct prefix_evpn, evp)
|
||||||
prefixtype(prefixptr, struct prefix_fs, fs)
|
uniontype(prefixptr, struct prefix_fs, fs)
|
||||||
prefixtype(prefixptr, struct prefix_rd, rd)
|
uniontype(prefixptr, struct prefix_rd, rd)
|
||||||
} TRANSPARENT_UNION;
|
} TRANSPARENT_UNION;
|
||||||
|
|
||||||
union prefixconstptr {
|
union prefixconstptr {
|
||||||
prefixtype(prefixconstptr, const struct prefix, p)
|
uniontype(prefixconstptr, const struct prefix, p)
|
||||||
prefixtype(prefixconstptr, const struct prefix_ipv4, p4)
|
uniontype(prefixconstptr, const struct prefix_ipv4, p4)
|
||||||
prefixtype(prefixconstptr, const struct prefix_ipv6, p6)
|
uniontype(prefixconstptr, const struct prefix_ipv6, p6)
|
||||||
prefixtype(prefixconstptr, const struct prefix_evpn, evp)
|
uniontype(prefixconstptr, const struct prefix_evpn, evp)
|
||||||
prefixtype(prefixconstptr, const struct prefix_fs, fs)
|
uniontype(prefixconstptr, const struct prefix_fs, fs)
|
||||||
prefixtype(prefixconstptr, const struct prefix_rd, rd)
|
uniontype(prefixconstptr, const struct prefix_rd, rd)
|
||||||
} TRANSPARENT_UNION;
|
} TRANSPARENT_UNION;
|
||||||
|
/* clang-format on */
|
||||||
|
|
||||||
#ifndef INET_ADDRSTRLEN
|
#ifndef INET_ADDRSTRLEN
|
||||||
#define INET_ADDRSTRLEN 16
|
#define INET_ADDRSTRLEN 16
|
||||||
|
@ -33,13 +33,13 @@ typedef struct in_addr pim_addr;
|
|||||||
#define PIM_ADDR_FUNCNAME(name) ipv4_##name
|
#define PIM_ADDR_FUNCNAME(name) ipv4_##name
|
||||||
|
|
||||||
union pimprefixptr {
|
union pimprefixptr {
|
||||||
prefixtype(pimprefixptr, struct prefix, p)
|
uniontype(pimprefixptr, struct prefix, p)
|
||||||
prefixtype(pimprefixptr, struct prefix_ipv4, p4)
|
uniontype(pimprefixptr, struct prefix_ipv4, p4)
|
||||||
} TRANSPARENT_UNION;
|
} TRANSPARENT_UNION;
|
||||||
|
|
||||||
union pimprefixconstptr {
|
union pimprefixconstptr {
|
||||||
prefixtype(pimprefixconstptr, const struct prefix, p)
|
uniontype(pimprefixconstptr, const struct prefix, p)
|
||||||
prefixtype(pimprefixconstptr, const struct prefix_ipv4, p4)
|
uniontype(pimprefixconstptr, const struct prefix_ipv4, p4)
|
||||||
} TRANSPARENT_UNION;
|
} TRANSPARENT_UNION;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
@ -63,13 +63,13 @@ typedef struct in6_addr pim_addr;
|
|||||||
#define PIM_ADDR_FUNCNAME(name) ipv6_##name
|
#define PIM_ADDR_FUNCNAME(name) ipv6_##name
|
||||||
|
|
||||||
union pimprefixptr {
|
union pimprefixptr {
|
||||||
prefixtype(pimprefixptr, struct prefix, p)
|
uniontype(pimprefixptr, struct prefix, p)
|
||||||
prefixtype(pimprefixptr, struct prefix_ipv6, p6)
|
uniontype(pimprefixptr, struct prefix_ipv6, p6)
|
||||||
} TRANSPARENT_UNION;
|
} TRANSPARENT_UNION;
|
||||||
|
|
||||||
union pimprefixconstptr {
|
union pimprefixconstptr {
|
||||||
prefixtype(pimprefixconstptr, const struct prefix, p)
|
uniontype(pimprefixconstptr, const struct prefix, p)
|
||||||
prefixtype(pimprefixconstptr, const struct prefix_ipv6, p6)
|
uniontype(pimprefixconstptr, const struct prefix_ipv6, p6)
|
||||||
} TRANSPARENT_UNION;
|
} TRANSPARENT_UNION;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user