mirror of
https://github.com/openvswitch/ovs
synced 2025-08-31 14:25:26 +00:00
ofpbuf: Make ofpbufs initialized with ofpbuf_use_stack() not expandable.
My original intent for ofpbufs initialized with ofpbuf_use_stack() was that the caller was providing enough space on the stack for the common case, with dynamic allocation as a fallback. But in practice, none of the clients actually do this. Instead, all of them actually know that the stack-allocated buffer is big enough and, since they don't want to bother with having to call ofpbuf_delete(), they instead assert that the buffer wasn't reallocated. Since this is a bit of a pain, this commit changes the semantics of ofpbuf_use_stack() to be that the stack-allocated buffer cannot be reallocated at all. This is more convenient for the existing clients.
This commit is contained in:
@@ -911,7 +911,6 @@ dpif_netdev_flow_dump_next(const struct dpif *dpif, void *state_,
|
||||
|
||||
ofpbuf_use_stack(&buf, &state->keybuf, sizeof state->keybuf);
|
||||
odp_flow_key_from_flow(&buf, &flow->key);
|
||||
assert(buf.base == &state->keybuf);
|
||||
|
||||
*key = buf.data;
|
||||
*key_len = buf.size;
|
||||
|
Reference in New Issue
Block a user