diff options
| author | Ben Pfaff <blp@nicira.com> | 2011-03-02 13:39:59 -0800 |
|---|---|---|
| committer | Ben Pfaff <blp@nicira.com> | 2011-03-30 15:08:47 -0700 |
| commit | 7ecb095d0bf4940406ce684c5c6d5c7adac4cf77 (patch) | |
| tree | ed2810d109839a1f9b4c49e4be0bba576d3251ef /lib/ofpbuf.h | |
| parent | 19cf40693da2e6e7612268fc6708fc6c879ebdff (diff) | |
| download | openvswitch-7ecb095d0bf4940406ce684c5c6d5c7adac4cf77.tar.gz | |
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.
Diffstat (limited to 'lib/ofpbuf.h')
| -rw-r--r-- | lib/ofpbuf.h | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/ofpbuf.h b/lib/ofpbuf.h index b8e367041..34fcf5f7f 100644 --- a/lib/ofpbuf.h +++ b/lib/ofpbuf.h @@ -28,8 +28,7 @@ extern "C" { enum ofpbuf_source { OFPBUF_MALLOC, /* Obtained via malloc(). */ - OFPBUF_STACK, /* Stack space or static buffer. */ - OFPBUF_CONST /* Must not be expanded. */ + OFPBUF_STACK /* Stack space or static buffer. */ }; /* Buffer for holding arbitrary data. An ofpbuf is automatically reallocated |
