From 2013493bd66415216730a51534480eb7fd465133 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Tue, 7 Dec 2010 15:47:19 -0800 Subject: [PATCH 1/1] ofp-util: Use ofpbuf_use_const() in a few more places. --- lib/ofp-util.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/lib/ofp-util.c b/lib/ofp-util.c index 471ed5169..a9df01383 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); -- 2.43.0