diff options
author | Andy Zhou <azhou@nicira.com> | 2015-08-11 14:08:42 -0700 |
---|---|---|
committer | Andy Zhou <azhou@nicira.com> | 2015-09-01 15:17:04 -0700 |
commit | 4ac6dbe630d84edc0c622fefd4a48ac3f96814e8 (patch) | |
tree | 909aed7e36aca5c075f439d8b8e2f9c1c1e133e1 /lib/ofpbuf.c | |
parent | b614072b993f7fcbd29b517c6b03b2a2888c69c4 (diff) | |
download | openvswitch-4ac6dbe630d84edc0c622fefd4a48ac3f96814e8.tar.gz |
lib/ofpbuf: refactor ofpbuf_use__() API
Add the size to its parameter list.
Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
Diffstat (limited to 'lib/ofpbuf.c')
-rw-r--r-- | lib/ofpbuf.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/lib/ofpbuf.c b/lib/ofpbuf.c index 05b513cc1..9b9d6b2d9 100644 --- a/lib/ofpbuf.c +++ b/lib/ofpbuf.c @@ -33,12 +33,12 @@ ofpbuf_init__(struct ofpbuf *b, size_t allocated, enum ofpbuf_source source) } static void -ofpbuf_use__(struct ofpbuf *b, void *base, size_t allocated, +ofpbuf_use__(struct ofpbuf *b, void *base, size_t allocated, size_t size, enum ofpbuf_source source) { b->base = base; b->data = base; - b->size = 0; + b->size = size; ofpbuf_init__(b, allocated, source); } @@ -50,7 +50,7 @@ ofpbuf_use__(struct ofpbuf *b, void *base, size_t allocated, void ofpbuf_use(struct ofpbuf *b, void *base, size_t allocated) { - ofpbuf_use__(b, base, allocated, OFPBUF_MALLOC); + ofpbuf_use__(b, base, allocated, 0, OFPBUF_MALLOC); } /* Initializes 'b' as an empty ofpbuf that contains the 'allocated' bytes of @@ -70,7 +70,7 @@ ofpbuf_use(struct ofpbuf *b, void *base, size_t allocated) void ofpbuf_use_stack(struct ofpbuf *b, void *base, size_t allocated) { - ofpbuf_use__(b, base, allocated, OFPBUF_STACK); + ofpbuf_use__(b, base, allocated, 0, OFPBUF_STACK); } /* Initializes 'b' as an empty ofpbuf that contains the 'allocated' bytes of @@ -90,7 +90,7 @@ ofpbuf_use_stack(struct ofpbuf *b, void *base, size_t allocated) void ofpbuf_use_stub(struct ofpbuf *b, void *base, size_t allocated) { - ofpbuf_use__(b, base, allocated, OFPBUF_STUB); + ofpbuf_use__(b, base, allocated, 0, OFPBUF_STUB); } /* Initializes 'b' as an ofpbuf whose data starts at 'data' and continues for @@ -103,8 +103,7 @@ ofpbuf_use_stub(struct ofpbuf *b, void *base, size_t allocated) void ofpbuf_use_const(struct ofpbuf *b, const void *data, size_t size) { - ofpbuf_use__(b, CONST_CAST(void *, data), size, OFPBUF_STACK); - b->size = size; + ofpbuf_use__(b, CONST_CAST(void *, data), size, size, OFPBUF_STACK); } /* Initializes 'b' as an empty ofpbuf with an initial capacity of 'size' |