X-Git-Url: https://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Fbytestring%2Fbytestring.h;fp=ccan%2Fbytestring%2Fbytestring.h;h=34d81af2038e4bc5ea0c481e19f27ffb6620ae2a;hp=62141bea41149a30bd61214e8804d50c23e4c971;hb=b529270bf1ce198a310046d83c8e5d9356dcfe15;hpb=f1e31c66572ef5997e08a1ecadf2e45b2fb04532 diff --git a/ccan/bytestring/bytestring.h b/ccan/bytestring/bytestring.h index 62141bea..34d81af2 100644 --- a/ccan/bytestring/bytestring.h +++ b/ccan/bytestring/bytestring.h @@ -200,4 +200,24 @@ static inline struct bytestring bytestring_bytestring(struct bytestring haystack return bytestring_NULL; } +/** + * bytestring_spn - search a bytestring for a set of bytes + * @s: a bytestring + * @accept: a bytestring containing a set of bytes to accept + * + * Returns the length, in bytes, of the initial segment of @s which + * consists entirely of characters in @accept. + */ +size_t bytestring_spn(struct bytestring s, struct bytestring accept); + +/** + * bytestring_cspn - search a bytestring for a set of bytes (complemented) + * @s: a bytestring + * @reject: a bytestring containing a set of bytes to reject + * + * Returns the length, in bytes, of the initial segment of @s which + * consists entirely of characters not in @reject. + */ +size_t bytestring_cspn(struct bytestring s, struct bytestring reject); + #endif /* CCAN_BYTESTRING_H_ */