[ovs-dev] [ofp-print 02/18] ofp-util: Use ofpbuf_use_const() in a few more places.
Ben Pfaff
blp at nicira.com
Thu Dec 9 00:26:54 UTC 2010
---
lib/ofp-util.c | 9 +++------
1 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/lib/ofp-util.c b/lib/ofp-util.c
index f37b644..7673b66 100644
--- a/lib/ofp-util.c
+++ b/lib/ofp-util.c
@@ -887,8 +887,7 @@ ofputil_decode_flow_mod(struct flow_mod *fm, const struct ofp_header *oh,
const struct ofputil_msg_type *type;
struct ofpbuf b;
- b.data = (void *) oh;
- b.size = ntohs(oh->length);
+ ofpbuf_use_const(&b, oh, ntohs(oh->length));
ofputil_decode_msg_type(oh, &type);
if (ofputil_msg_type_code(type) == OFPUTIL_OFPT_FLOW_MOD) {
@@ -1053,8 +1052,7 @@ ofputil_decode_nxst_flow_request(struct flow_stats_request *fsr,
struct ofpbuf b;
int error;
- b.data = (void *) oh;
- b.size = ntohs(oh->length);
+ ofpbuf_use_const(&b, oh, ntohs(oh->length));
nfsr = ofpbuf_try_pull(&b, sizeof *nfsr);
if (!nfsr) {
@@ -1088,8 +1086,7 @@ ofputil_decode_flow_stats_request(struct flow_stats_request *fsr,
struct ofpbuf b;
int code;
- b.data = (void *) oh;
- b.size = ntohs(oh->length);
+ ofpbuf_use_const(&b, oh, ntohs(oh->length));
ofputil_decode_msg_type(oh, &type);
code = ofputil_msg_type_code(type);
--
1.7.1
More information about the dev
mailing list