2
0
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:
Ben Pfaff
2011-03-02 13:39:59 -08:00
parent 19cf40693d
commit 7ecb095d0b
4 changed files with 5 additions and 15 deletions

View File

@@ -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;