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) {
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) {
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);