int utf8_strncmp(conststruct unicode_map *um, conststruct qstr *s1, conststruct qstr *s2)
{ struct utf8cursor cur1, cur2; int c1, c2;
if (utf8ncursor(&cur1, um, UTF8_NFDI, s1->name, s1->len) < 0) return -EINVAL;
if (utf8ncursor(&cur2, um, UTF8_NFDI, s2->name, s2->len) < 0) return -EINVAL;
do {
c1 = utf8byte(&cur1);
c2 = utf8byte(&cur2);
if (c1 < 0 || c2 < 0) return -EINVAL; if (c1 != c2) return 1;
} while (c1);
return 0;
}
EXPORT_SYMBOL(utf8_strncmp);
int utf8_strncasecmp(conststruct unicode_map *um, conststruct qstr *s1, conststruct qstr *s2)
{ struct utf8cursor cur1, cur2; int c1, c2;
if (utf8ncursor(&cur1, um, UTF8_NFDICF, s1->name, s1->len) < 0) return -EINVAL;
if (utf8ncursor(&cur2, um, UTF8_NFDICF, s2->name, s2->len) < 0) return -EINVAL;
do {
c1 = utf8byte(&cur1);
c2 = utf8byte(&cur2);
if (c1 < 0 || c2 < 0) return -EINVAL; if (c1 != c2) return 1;
} while (c1);
return 0;
}
EXPORT_SYMBOL(utf8_strncasecmp);
/* String cf is expected to be a valid UTF-8 casefolded * string.
*/ int utf8_strncasecmp_folded(conststruct unicode_map *um, conststruct qstr *cf, conststruct qstr *s1)
{ struct utf8cursor cur1; int c1, c2; int i = 0;
if (utf8ncursor(&cur1, um, UTF8_NFDICF, s1->name, s1->len) < 0) return -EINVAL;
do {
c1 = utf8byte(&cur1);
c2 = cf->name[i++]; if (c1 < 0) return -EINVAL; if (c1 != c2) return 1;
} while (c1);
/** * utf8_parse_version - Parse a UTF-8 version number from a string * * @version: input string * * Returns the parsed version on success, negative code on error
*/ int utf8_parse_version(char *version)
{
substring_t args[3]; unsignedint maj, min, rev; staticconststruct match_token token[] = {
{1, "%d.%d.%d"},
{0, NULL}
};
if (match_token(version, token, args) != 1) return -EINVAL;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.