The code is easier to reason about with all of the assignments to the members of 'reply' in one place.
Suggested-by: Andy Zhou <az...@ovn.org> Signed-off-by: Ben Pfaff <b...@ovn.org> --- lib/ofp-util.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/ofp-util.c b/lib/ofp-util.c index fd23a3a..19901d1 100644 --- a/lib/ofp-util.c +++ b/lib/ofp-util.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Nicira, Inc. + * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -2033,13 +2033,14 @@ ofputil_append_meter_config(struct ovs_list *replies, { struct ofpbuf *msg = ofpbuf_from_list(list_back(replies)); size_t start_ofs = msg->size; - struct ofp13_meter_config *reply = ofpbuf_put_uninit(msg, sizeof *reply); - reply->flags = htons(mc->flags); - reply->meter_id = htonl(mc->meter_id); + struct ofp13_meter_config *reply; + ofpbuf_put_uninit(msg, sizeof *reply); ofputil_put_bands(mc->n_bands, mc->bands, msg); reply = ofpbuf_at_assert(msg, start_ofs, sizeof *reply); + reply->flags = htons(mc->flags); + reply->meter_id = htonl(mc->meter_id); reply->length = htons(msg->size - start_ofs); ofpmp_postappend(replies, start_ofs); -- 2.1.3 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev