MCPcopy Create free account
hub / github.com/coreutils/coreutils / mbsmbchr

Function mbsmbchr

src/numfmt.c:1392–1404  ·  view source on GitHub ↗

Search for multi-byte character C in multi-byte string S. Return a pointer to the character, or NULL if not found. */

Source from the content-addressed store, hash-verified

1390/* Search for multi-byte character C in multi-byte string S.
1391 Return a pointer to the character, or NULL if not found. */
1392ATTRIBUTE_PURE
1393static char *
1394mbsmbchr (char const *s, char const *c)
1395{
1396 unsigned char uc = *c;
1397 /* GB18030 is the most restrictive for the 0x30 optimization below. */
1398 if (uc < 0x30 || MB_CUR_MAX == 1)
1399 return (char *) strchr (s, uc);
1400 else if (is_utf8_charset ())
1401 return (char *) (uc < 0x80 ? strchr (s, uc) : strstr (s, c));
1402 else
1403 return *(c + 1) == '\0' ? mbschr (s, uc) : (char *) mbsstr (s, c);
1404}
1405
1406/* Return a pointer to the beginning of the next field in line.
1407 The line pointer is moved to the end of the next field. */

Callers 1

next_fieldFunction · 0.85

Calls 1

is_utf8_charsetFunction · 0.85

Tested by

no test coverage detected