public inbox for ccan@ozlabs.org
 help / color / mirror / Atom feed
From: Cody P Schafer <dev@codyps.com>
To: ccan@lists.ozlabs.org
Cc: Cody P Schafer <dev@codyps.com>
Subject: [PATCH v4 0/4] mem: extend with a few additional helpers similar to existing string-only functions
Date: Sat,  5 Sep 2015 21:21:02 -0400	[thread overview]
Message-ID: <1441502466-4754-1-git-send-email-dev@codyps.com> (raw)

since v3:

 - fix memeq() return value
 - add memends_str() helper

since v2:

 - switch all the macros to static inline to avoid multiple evaluations of args
 - add patch adding PURE_FUNCTION attributes

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 sent 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 (4):
  mem: add mem helper functions
  bytestring: use newly added mem helpers
  mem: mark all functions as PURE
  mem: add memends_str() helper for symmetry

 ccan/bytestring/bytestring.h |   9 +--
 ccan/mem/_info               |   1 +
 ccan/mem/mem.c               |  24 ++++++
 ccan/mem/mem.h               | 185 +++++++++++++++++++++++++++++++++++++++++++
 ccan/mem/test/api.c          |  41 +++++++++-
 5 files changed, 253 insertions(+), 7 deletions(-)

-- 
2.5.1

_______________________________________________
ccan mailing list
ccan@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/ccan

             reply	other threads:[~2015-09-06  1:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-06  1:21 Cody P Schafer [this message]
2015-09-06  1:21 ` [PATCH v4 1/4] mem: add mem helper functions Cody P Schafer
2015-09-06  1:21 ` [PATCH v4 2/4] bytestring: use newly added mem helpers Cody P Schafer
2015-09-06  1:21 ` [PATCH v4 3/4] mem: mark all functions as PURE Cody P Schafer
2015-09-06  1:21 ` [PATCH v4 4/4] mem: add memends_str() helper for symmetry Cody P Schafer
2015-09-06 14:24 ` [PATCH v4 0/4] mem: extend with a few additional helpers similar to existing string-only functions David Gibson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1441502466-4754-1-git-send-email-dev@codyps.com \
    --to=dev@codyps.com \
    --cc=ccan@lists.ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox