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:
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user