X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lib%2Fofpbuf.c;h=1b18b14adea1dd17c355730d68a63f3238bafa0c;hb=da546e076495672ab67106bb6dbb42447c1a2d26;hp=30ae12e6d1118408c83931399c1fd030a17ce2e4;hpb=881d47a9fa901e71953a34367e9cd9b1f0571808;p=sliver-openvswitch.git diff --git a/lib/ofpbuf.c b/lib/ofpbuf.c index 30ae12e6d..1b18b14ad 100644 --- a/lib/ofpbuf.c +++ b/lib/ofpbuf.c @@ -431,6 +431,17 @@ ofpbuf_reserve(struct ofpbuf *b, size_t size) b->data = (char*)b->data + size; } +/* Reserves 'size' bytes of headroom so that they can be later allocated with + * ofpbuf_push_uninit() without reallocating the ofpbuf. */ +void +ofpbuf_reserve_with_tailroom(struct ofpbuf *b, size_t headroom, + size_t tailroom) +{ + ovs_assert(!b->size); + ofpbuf_prealloc_tailroom(b, headroom + tailroom); + b->data = (char*)b->data + headroom; +} + /* Prefixes 'size' bytes to the head end of 'b', reallocating and copying its * data if necessary. Returns a pointer to the first byte of the data's * location in the ofpbuf. The new data is left uninitialized. */