[ovs-dev] [PATCH] ofpbuf: Remove OFPBUF_STACK_BUFFER.

Ben Pfaff blp at nicira.com
Fri Mar 1 19:03:33 UTC 2013


Thanks, I applied it to master.

On Fri, Mar 01, 2013 at 10:26:56AM -0800, Andy Zhou wrote:
> This looks good.
> 
> 
> On Wed, Feb 27, 2013 at 5:03 PM, Ben Pfaff <blp at nicira.com> wrote:
> 
> > Its alleged convenience just doesn't outweigh the syntactical ugliness, and
> > so it didn't have any users.
> >
> > Signed-off-by: Ben Pfaff <blp at nicira.com>
> > ---
> >  lib/ofpbuf.c |    6 +++---
> >  lib/ofpbuf.h |    6 +-----
> >  2 files changed, 4 insertions(+), 8 deletions(-)
> >
> > diff --git a/lib/ofpbuf.c b/lib/ofpbuf.c
> > index fd10da3..c960a7e 100644
> > --- a/lib/ofpbuf.c
> > +++ b/lib/ofpbuf.c
> > @@ -1,5 +1,5 @@
> >  /*
> > - * Copyright (c) 2008, 2009, 2010, 2011, 2012 Nicira, Inc.
> > + * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 Nicira, Inc.
> >   *
> >   * Licensed under the Apache License, Version 2.0 (the "License");
> >   * you may not use this file except in compliance with the License.
> > @@ -52,7 +52,7 @@ ofpbuf_use(struct ofpbuf *b, void *base, size_t
> > allocated)
> >   *
> >   * 'base' should be appropriately aligned.  Using an array of uint32_t or
> >   * uint64_t for the buffer is a reasonable way to ensure appropriate
> > alignment
> > - * for 32- or 64-bit data.  OFPBUF_STACK_BUFFER is a convenient way to do
> > so.
> > + * for 32- or 64-bit data.
> >   *
> >   * An ofpbuf operation that requires reallocating data will assert-fail
> > if this
> >   * function was used to initialize it.  Thus, one need not call
> > ofpbuf_uninit()
> > @@ -72,7 +72,7 @@ ofpbuf_use_stack(struct ofpbuf *b, void *base, size_t
> > allocated)
> >   *
> >   * 'base' should be appropriately aligned.  Using an array of uint32_t or
> >   * uint64_t for the buffer is a reasonable way to ensure appropriate
> > alignment
> > - * for 32- or 64-bit data.  OFPBUF_STACK_BUFFER is a convenient way to do
> > so.
> > + * for 32- or 64-bit data.
> >   *
> >   * An ofpbuf operation that requires reallocating data will copy the
> > provided
> >   * buffer into a malloc()'d buffer.  Thus, it is wise to call
> > ofpbuf_uninit()
> > diff --git a/lib/ofpbuf.h b/lib/ofpbuf.h
> > index bae3c0a..8b03c7e 100644
> > --- a/lib/ofpbuf.h
> > +++ b/lib/ofpbuf.h
> > @@ -1,5 +1,5 @@
> >  /*
> > - * Copyright (c) 2008, 2009, 2010, 2011, 2012 Nicira, Inc.
> > + * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 Nicira, Inc.
> >   *
> >   * Licensed under the Apache License, Version 2.0 (the "License");
> >   * you may not use this file except in compliance with the License.
> > @@ -52,10 +52,6 @@ struct ofpbuf {
> >      void *private_p;            /* Private pointer for use by owner. */
> >  };
> >
> > -/* Declares NAME as a SIZE-byte array aligned properly for storing any
> > kind of
> > - * data.  For use with ofpbuf_use_stack(). */
> > -#define OFPBUF_STACK_BUFFER(NAME, SIZE) uint64_t NAME[DIV_ROUND_UP(SIZE,
> > 8)]
> > -
> >  void ofpbuf_use(struct ofpbuf *, void *, size_t);
> >  void ofpbuf_use_stack(struct ofpbuf *, void *, size_t);
> >  void ofpbuf_use_stub(struct ofpbuf *, void *, size_t);
> > --
> > 1.7.2.5
> >
> > _______________________________________________
> > dev mailing list
> > dev at openvswitch.org
> > http://openvswitch.org/mailman/listinfo/dev
> >



More information about the dev mailing list