MCPcopy Create free account
hub / github.com/git/git / regexec_supports_multi_byte_chars

Function regexec_supports_multi_byte_chars

userdiff.c:401–418  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

399}
400
401static int regexec_supports_multi_byte_chars(void)
402{
403 static const char not_space[] = "[^[:space:]]";
404 static const char utf8_multi_byte_char[] = "\xc2\xa3";
405 regex_t re;
406 regmatch_t match;
407 static int result = -1;
408
409 if (result != -1)
410 return result;
411 if (regcomp(&re, not_space, REG_EXTENDED))
412 BUG("invalid regular expression: %s", not_space);
413 result = !regexec(&re, utf8_multi_byte_char, 1, &match, 0) &&
414 match.rm_so == 0 &&
415 match.rm_eo == strlen(utf8_multi_byte_char);
416 regfree(&re);
417 return result;
418}
419
420static struct userdiff_driver *userdiff_find_by_namelen(const char *name, size_t len)
421{

Callers 1

userdiff_find_by_nameFunction · 0.85

Calls 2

regcompFunction · 0.85
regfreeFunction · 0.85

Tested by

no test coverage detected