From c0a56d9fe1fdb57220b9c1e2f709ea2db5d6489d Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Thu, 28 Oct 2010 13:20:23 -0700 Subject: [PATCH] test-classifier: Use get_unaligned_u32() from unaligned.h. There's no point in defining our own code to do this here. --- tests/test-classifier.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/tests/test-classifier.c b/tests/test-classifier.c index a0ed0241..783c59e2 100644 --- a/tests/test-classifier.c +++ b/tests/test-classifier.c @@ -33,6 +33,7 @@ #include "command-line.h" #include "flow.h" #include "packets.h" +#include "unaligned.h" #undef NDEBUG #include @@ -195,14 +196,6 @@ tcls_remove(struct tcls *cls, const struct test_rule *rule) NOT_REACHED(); } -static uint32_t -read_uint32(const void *p) -{ - uint32_t x; - memcpy(&x, p, sizeof x); - return x; -} - static bool match(const struct cls_rule *wild, const struct flow *fixed) { @@ -220,8 +213,8 @@ match(const struct cls_rule *wild, const struct flow *fixed) } if (wild->wc.wildcards & f->wildcards) { - uint32_t test = read_uint32(wild_field); - uint32_t ip = read_uint32(fixed_field); + uint32_t test = get_unaligned_u32(wild_field); + uint32_t ip = get_unaligned_u32(fixed_field); int shift = (f_idx == CLS_F_IDX_NW_SRC ? OFPFW_NW_SRC_SHIFT : OFPFW_NW_DST_SHIFT); uint32_t mask = flow_nw_bits_to_mask(wild->wc.wildcards, shift); -- 2.30.2