[ccan] [PATCH 1/9] bytestring: Add bytestring_byte() function
David Gibson
david at gibson.dropbear.id.au
Tue Jul 29 00:34:14 EST 2014
On Mon, Jul 28, 2014 at 09:45:00PM +1000, Brad Hards wrote:
> On Mon, 28 Jul 2014 07:59:49 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..93736d8 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
> > + * @s: bytestring
> > + * @n: index
> > + *
> > + * Return te @n-th byte from @s. Aborts (via assert) if @n is out of
> Typo: te -> the
Thanks, fixed.
--
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/20140729/3f0d72bd/attachment.sig>
More information about the ccan
mailing list