From ca996d807f57f54a411259d3c49422cc5e26417c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20Tvrd=C3=ADk?= Date: Mon, 3 Aug 2015 09:03:38 +0200 Subject: [PATCH] Birdtest: Use origin macros from lib/ip.h Thanks to Ondrej 'Santiago' Zajicek --- lib/ip_test.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/lib/ip_test.c b/lib/ip_test.c index 1d307b4d..8bab9eaf 100644 --- a/lib/ip_test.c +++ b/lib/ip_test.c @@ -13,12 +13,6 @@ #define IP4_MAX_LEN 16 -static u32 -build_ip4(u8 a, u8 b, u8 c, u8 d) -{ - return ((u32)a << 24) + ((u32)b << 16) + ((u32)c << 8) + (u32)d; -} - static u32 ip4_pton_(char *s) { @@ -36,15 +30,15 @@ t_ip4_pton(void) } in_out[] = { { .in = "192.168.1.128", - .out = build_ip4(192, 168, 1, 128), + .out = ip4_to_u32(ip4_build(192, 168, 1, 128)), }, { .in = "255.255.255.255", - .out = build_ip4(255, 255, 255, 255), + .out = ip4_to_u32(ip4_build(255, 255, 255, 255)), }, { .in = "0.0.0.0", - .out = build_ip4(0, 0, 0, 0), + .out = ip4_to_u32(ip4_build(0, 0, 0, 0)), }, }; @@ -119,15 +113,15 @@ t_ip4_ntop(void) char out[IP4_MAX_LEN]; } in_out[] = { { - .in = ip4_from_u32(build_ip4(192, 168, 1, 128)), + .in = ip4_build(192, 168, 1, 128), .out = "192.168.1.128", }, { - .in = ip4_from_u32(build_ip4(255, 255, 255, 255)), + .in = ip4_build(255, 255, 255, 255), .out = "255.255.255.255", }, { - .in = ip4_from_u32(build_ip4(0, 0, 0, 1)), + .in = ip4_build(0, 0, 0, 1), .out = "0.0.0.1", },