MCPcopy Create free account
hub / github.com/F-Stack/f-stack / mempbrk

Function mempbrk

app/redis-6.2.6/src/util.c:250–257  ·  view source on GitHub ↗

Search a memory buffer for any set of bytes, like strpbrk(). * Returns pointer to first found char or NULL. */

Source from the content-addressed store, hash-verified

248 * Returns pointer to first found char or NULL.
249 */
250const char *mempbrk(const char *s, size_t len, const char *chars, size_t charslen) {
251 for (size_t j = 0; j < len; j++) {
252 for (size_t n = 0; n < charslen; n++)
253 if (s[j] == chars[n]) return &s[j];
254 }
255
256 return NULL;
257}
258
259/* Modify the buffer replacing all occurrences of chars from the 'from'
260 * set with the corresponding char in the 'to' set. Always returns s.

Callers 1

getSafeInfoStringFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected