[ovs-dev] [PATCH 03/16] ofpbuf: Mark ofpbuf_headroom(), ofpbuf_tailroom() parameters const.

Ben Pfaff blp at nicira.com
Thu Feb 11 15:18:05 PST 2010


---
 lib/ofpbuf.c |    4 ++--
 lib/ofpbuf.h |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/ofpbuf.c b/lib/ofpbuf.c
index bb21679..fd01ea8 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 259e703..b65f79e 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 *);
-- 
1.6.6.1





More information about the dev mailing list