diff options
author | David Lamparter <equinox@opensourcerouting.org> | 2013-10-22 17:10:21 +0000 |
---|---|---|
committer | David Lamparter <equinox@opensourcerouting.org> | 2014-04-01 17:27:58 +0200 |
commit | f7bf41534e885c7bc077529c591a1bce24a5f1e9 (patch) | |
tree | 2c119e01872468b249bba44e5f7d20da67147756 /lib | |
parent | db19c85679b08668c3dce73a655c21753042cf06 (diff) | |
download | quagga-f7bf41534e885c7bc077529c591a1bce24a5f1e9.tar.bz2 quagga-f7bf41534e885c7bc077529c591a1bce24a5f1e9.tar.xz |
zebra: apply syntactic sugar to rib_dump()
strip the explicit __func__ present on all calls and make the prefix
argument a transparent union.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/prefix.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/prefix.h b/lib/prefix.h index 8c8992e8..9ef70ff5 100644 --- a/lib/prefix.h +++ b/lib/prefix.h @@ -89,6 +89,25 @@ struct prefix_rd u_char val[8] __attribute__ ((aligned (8))); }; +/* helper to get type safety/avoid casts on calls + * (w/o this, functions accepting all prefix types need casts on the caller + * side, which strips type safety since the cast will accept any pointer + * type.) + */ +union prefix46ptr +{ + struct prefix *p; + struct prefix_ipv4 *p4; + struct prefix_ipv6 *p6; +} __attribute__ ((transparent_union)); + +union prefix46constptr +{ + const struct prefix *p; + const struct prefix_ipv4 *p4; + const struct prefix_ipv6 *p6; +} __attribute__ ((transparent_union)); + #ifndef INET_ADDRSTRLEN #define INET_ADDRSTRLEN 16 #endif /* INET_ADDRSTRLEN */ |