[ovs-dev] [PATCH 2/2] lib/ofpbuf: Rename private fields to discourage direct use.

Jarno Rajahalme jrajahalme at nicira.com
Tue Apr 8 21:07:24 UTC 2014


Thanks for review!

Pushed to master,

	Jarno

On Apr 8, 2014, at 10:12 AM, Alex Wang <alexw at nicira.com> wrote:

> Really like this one!
> 
> For both:
> Acked-by: Alex Wang <alexw at nicira.com>
> 
> 
> On Tue, Apr 8, 2014 at 8:59 AM, Jarno Rajahalme <jrajahalme at nicira.com> wrote:
> Direct use of 'data', 'base', and 'size' will break DPDK builds.  Try
> to wean us off the habit by renaming the fields.
> 
> Signed-off-by: Jarno Rajahalme <jrajahalme at nicira.com>
> ---
>  lib/ofpbuf.h |   18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/lib/ofpbuf.h b/lib/ofpbuf.h
> index ea863db..85be899 100644
> --- a/lib/ofpbuf.h
> +++ b/lib/ofpbuf.h
> @@ -60,9 +60,9 @@ struct ofpbuf {
>  #ifdef DPDK_NETDEV
>      struct rte_mbuf mbuf;       /* DPDK mbuf */
>  #else
> -    void *base;                 /* First byte of allocated space. */
> -    void *data;                 /* First byte actually in use. */
> -    uint32_t size;              /* Number of bytes in use. */
> +    void *base_;                 /* First byte of allocated space. */
> +    void *data_;                 /* First byte actually in use. */
> +    uint32_t size_;              /* Number of bytes in use. */
>  #endif
>      uint32_t allocated;         /* Number of bytes allocated. */
> 
> @@ -389,32 +389,32 @@ static inline void ofpbuf_set_size(struct ofpbuf *b, uint32_t v)
>  #else
>  static inline void * ofpbuf_data(const struct ofpbuf *b)
>  {
> -    return b->data;
> +    return b->data_;
>  }
> 
>  static inline void ofpbuf_set_data(struct ofpbuf *b, void *d)
>  {
> -    b->data = d;
> +    b->data_ = d;
>  }
> 
>  static inline void * ofpbuf_base(const struct ofpbuf *b)
>  {
> -    return b->base;
> +    return b->base_;
>  }
> 
>  static inline void ofpbuf_set_base(struct ofpbuf *b, void *d)
>  {
> -    b->base = d;
> +    b->base_ = d;
>  }
> 
>  static inline uint32_t ofpbuf_size(const struct ofpbuf *b)
>  {
> -    return b->size;
> +    return b->size_;
>  }
> 
>  static inline void ofpbuf_set_size(struct ofpbuf *b, uint32_t v)
>  {
> -    b->size = v;
> +    b->size_ = v;
>  }
>  #endif
> 
> --
> 1.7.10.4
> 
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openvswitch.org/pipermail/ovs-dev/attachments/20140408/d96eb350/attachment-0005.html>


More information about the dev mailing list