MCPcopy Create free account
hub / github.com/Kitware/VTK / xmlUTF8Strndup

Function xmlUTF8Strndup

ThirdParty/libxml2/vtklibxml2/xmlstring.c:1017–1031  ·  view source on GitHub ↗

* xmlUTF8Strndup: * @utf: the input UTF8 * * @len: the len of @utf (in chars) * * a strndup for array of UTF8's * * Returns a new UTF8 * or NULL */

Source from the content-addressed store, hash-verified

1015 * Returns a new UTF8 * or NULL
1016 */
1017xmlChar *
1018xmlUTF8Strndup(const xmlChar *utf, int len) {
1019 xmlChar *ret;
1020 int i;
1021
1022 if ((utf == NULL) || (len < 0)) return(NULL);
1023 i = xmlUTF8Strsize(utf, len);
1024 ret = (xmlChar *) xmlMallocAtomic((size_t) i + 1);
1025 if (ret == NULL) {
1026 return(NULL);
1027 }
1028 memcpy(ret, utf, i);
1029 ret[i] = 0;
1030 return(ret);
1031}
1032
1033/**
1034 * xmlUTF8Strpos:

Callers 1

xmlUTF8StrsubFunction · 0.85

Calls 1

xmlUTF8StrsizeFunction · 0.85

Tested by

no test coverage detected