From b01b4ec70f3e4d4a4648207e414a8f9eef8073e9 Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Wed, 13 Jun 2018 05:45:49 -0500 Subject: string: add __strcspn_c2 --- CHANGELOG.rst | 6 ++++++ libgcompat/string.c | 17 +++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 31475d4..3ad98fe 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -36,6 +36,12 @@ socket * Add __poll_chk +string +------ + +* Add __strcspn_c2. + + malloc ------ diff --git a/libgcompat/string.c b/libgcompat/string.c index 1d387a8..5a1e558 100644 --- a/libgcompat/string.c +++ b/libgcompat/string.c @@ -177,6 +177,23 @@ char *__strcpy_chk(char *dest, const char *src, size_t destlen) return strcpy(dest, src); } +/** + * Find the substring length of a string that does not have any two characters. + * + * Not defined in LSB 5.0. Used by spotify-client. + */ +size_t __strcspn_c2(const char *str, int bad, int bad2) +{ + size_t length = 0; + const char *s = str; + while(*s != bad && *s != bad2 && *s != '\0') + { + length++; + s++; + } + return length; +} + /** * Concatenate a string with part of another, with buffer overflow checking. * -- cgit v1.2.3-70-g09d2