[ovs-dev] [eviction 09/12] ofproto: Make ofproto_rule_destroy__() do nothing for a null argument.
Ethan Jackson
ethan at nicira.com
Mon Jan 23 21:50:07 UTC 2012
Looks good.
Ethan
On Fri, Jan 13, 2012 at 16:43, Ben Pfaff <blp at nicira.com> wrote:
> This is our customary way to implement a "destroy" function. It allows
> a minor simplification in ofoperation_complete().
>
> Signed-off-by: Ben Pfaff <blp at nicira.com>
> ---
> ofproto/ofproto.c | 10 +++++-----
> 1 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
> index cc309b3..abaa8f7 100644
> --- a/ofproto/ofproto.c
> +++ b/ofproto/ofproto.c
> @@ -1655,8 +1655,10 @@ set_internal_devs_mtu(struct ofproto *p)
> static void
> ofproto_rule_destroy__(struct rule *rule)
> {
> - free(rule->actions);
> - rule->ofproto->ofproto_class->rule_dealloc(rule);
> + if (rule) {
> + free(rule->actions);
> + rule->ofproto->ofproto_class->rule_dealloc(rule);
> + }
> }
>
> /* This function allows an ofproto implementation to destroy any rules that
> @@ -3277,9 +3279,7 @@ ofoperation_complete(struct ofoperation *op, enum ofperr error)
> switch (op->type) {
> case OFOPERATION_ADD:
> if (!error) {
> - if (op->victim) {
> - ofproto_rule_destroy__(op->victim);
> - }
> + ofproto_rule_destroy__(op->victim);
> if ((rule->cr.wc.vlan_tci_mask & htons(VLAN_VID_MASK))
> == htons(VLAN_VID_MASK)) {
> if (ofproto->vlan_bitmap) {
> --
> 1.7.2.5
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
More information about the dev
mailing list