[ccan] [PATCH 01/11] bytestring: Add bytestring_byte() function

David Gibson david at gibson.dropbear.id.au
Sat Oct 18 06:42:41 AEDT 2014


On Sun, Oct 12, 2014 at 10:56:42AM +1100, Brad Hards wrote:
> On Sat, 11 Oct 2014 06:43:26 PM David Gibson wrote:
> > Implement a bytestring_byte() function to extract a single byte / character
> > from a bytestring.
> > 
> > Signed-off-by: David Gibson <david at gibson.dropbear.id.au>
> > ---
> >  ccan/bytestring/bytestring.h | 15 +++++++++++++++
> >  ccan/bytestring/test/run.c   | 10 +++++++++-
> >  2 files changed, 24 insertions(+), 1 deletion(-)
> > 
> > diff --git a/ccan/bytestring/bytestring.h b/ccan/bytestring/bytestring.h
> > index 63472fe..77435c9 100644
> > --- a/ccan/bytestring/bytestring.h
> > +++ b/ccan/bytestring/bytestring.h
> > @@ -5,6 +5,7 @@
> >  #include <stdlib.h>
> >  #include <string.h>
> >  #include <stdbool.h>
> > +#include <assert.h>
> > 
> >  #include <ccan/array_size/array_size.h>
> > 
> > @@ -80,4 +81,18 @@ static inline bool bytestring_eq(struct bytestring a,
> > struct bytestring b) && (memcmp(a.ptr, b.ptr, a.len) == 0);
> >  }
> > 
> > +/**
> > + * bytestring_byte - extract a byte from a bytestring
> Perhaps "gets" or "selects" rather than extracts, which suggests get-and-
> remove.

Good idea.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/ccan/attachments/20141017/33a9e376/attachment.sig>


More information about the ccan mailing list