From: Ben Pfaff Date: Thu, 11 Feb 2010 22:59:01 +0000 (-0800) Subject: ofpbuf: Mark ofpbuf_headroom(), ofpbuf_tailroom() parameters const. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5019f688d4e3117960503d57978ff2e0fb3771e0;p=openvswitch ofpbuf: Mark ofpbuf_headroom(), ofpbuf_tailroom() parameters const. --- diff --git a/lib/ofpbuf.c b/lib/ofpbuf.c index bb216791..fd01ea8d 100644 --- a/lib/ofpbuf.c +++ b/lib/ofpbuf.c @@ -103,7 +103,7 @@ ofpbuf_delete(struct ofpbuf *b) * commonly, the data in a ofpbuf is at its beginning, and thus the ofpbuf's * headroom is 0.) */ size_t -ofpbuf_headroom(struct ofpbuf *b) +ofpbuf_headroom(const struct ofpbuf *b) { return (char*)b->data - (char*)b->base; } @@ -111,7 +111,7 @@ ofpbuf_headroom(struct ofpbuf *b) /* Returns the number of bytes that may be appended to the tail end of ofpbuf * 'b' before the ofpbuf must be reallocated. */ size_t -ofpbuf_tailroom(struct ofpbuf *b) +ofpbuf_tailroom(const struct ofpbuf *b) { return (char*)ofpbuf_end(b) - (char*)ofpbuf_tail(b); } diff --git a/lib/ofpbuf.h b/lib/ofpbuf.h index 259e703c..b65f79ee 100644 --- a/lib/ofpbuf.h +++ b/lib/ofpbuf.h @@ -64,8 +64,8 @@ void ofpbuf_reserve(struct ofpbuf *, size_t); void *ofpbuf_push_uninit(struct ofpbuf *b, size_t); void *ofpbuf_push(struct ofpbuf *b, const void *, size_t); -size_t ofpbuf_headroom(struct ofpbuf *); -size_t ofpbuf_tailroom(struct ofpbuf *); +size_t ofpbuf_headroom(const struct ofpbuf *); +size_t ofpbuf_tailroom(const struct ofpbuf *); void ofpbuf_prealloc_headroom(struct ofpbuf *, size_t); void ofpbuf_prealloc_tailroom(struct ofpbuf *, size_t); void ofpbuf_trim(struct ofpbuf *);