[ccan] [PATCH v2 0/2] mem: extend with a few additional helpers similar to existing string-only functions

Cody P Schafer dev at codyps.com
Thu Aug 20 10:19:48 AEST 2015


since v1:

 - drop a patch that David pulled in
 - add extra macro parens
 - add blank lines after defintions
 - covert memcchr's while loop to a for.
 - change examples for mempbrkm and mempbrk to use '\0' in places
 - fix spelling
 - use memeq() even where we know the mem lengths are equal in memstarts()
 - add a reviewed-by to the 2nd patch, no other changes to that patch.

--

This is essentially a rebased version of a patch I send out quite some time ago.

At the time, David indicated that it would probably make sense for bytestring
to call the plain mem-versions of these functions, so I've included a helper to
do that as well (and 1 patch to help ccanlint for bytestring pass a bit better).

The selection of mem* functions is entirely based on which ones I need for some
code I was writing, and they are in no way complete (notably, they include mem
variants of strpbrk instead of strspn variants as used in bytestring). I expect
the missing functions can be added as people find a need for them.

Cody P Schafer (2):
  mem: add mem helper functions
  bytestring: use newly added mem helpers

 ccan/bytestring/bytestring.h |   9 +--
 ccan/mem/mem.c               |  24 +++++++
 ccan/mem/mem.h               | 146 +++++++++++++++++++++++++++++++++++++++++++
 ccan/mem/test/api.c          |  37 ++++++++++-
 4 files changed, 209 insertions(+), 7 deletions(-)

-- 
2.5.0



More information about the ccan mailing list