From: Ben Pfaff Date: Tue, 7 Dec 2010 23:47:19 +0000 (-0800) Subject: ofp-util: Use ofpbuf_use_const() in a few more places. X-Git-Tag: v1.1.0~710 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=2013493bd66415216730a51534480eb7fd465133;hp=dab45bfd5748e7d871ae312df6e9b7ce89a8f46c;p=sliver-openvswitch.git ofp-util: Use ofpbuf_use_const() in a few more places. --- 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);