2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 14:25:26 +00:00

ofp-util: New functions ofputil_actions_equal(), ofputil_actions_clone().

I found that introducing these helper functions provided a very modest
increase in readability.
This commit is contained in:
Ben Pfaff
2011-05-26 16:49:10 -07:00
parent 1be5ff7596
commit 18ddadc2e9
2 changed files with 17 additions and 0 deletions

View File

@@ -2565,3 +2565,16 @@ error:
*n_actionsp = 0;
return ofp_mkerr(OFPET_BAD_REQUEST, OFPBRC_BAD_LEN);
}
bool
ofputil_actions_equal(const union ofp_action *a, size_t n_a,
const union ofp_action *b, size_t n_b)
{
return n_a == n_b && (!n_a || !memcmp(a, b, n_a * sizeof *a));
}
union ofp_action *
ofputil_actions_clone(const union ofp_action *actions, size_t n)
{
return n ? xmemdup(actions, n * sizeof *actions) : NULL;
}