MCPcopy Create free account
hub / github.com/JuliaStrings/utf8proc / utf8proc_map_custom

Function utf8proc_map_custom

utf8proc.c:775–803  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

773}
774
775UTF8PROC_DLLEXPORT utf8proc_ssize_t utf8proc_map_custom(
776 const utf8proc_uint8_t *str, utf8proc_ssize_t strlen, utf8proc_uint8_t **dstptr, utf8proc_option_t options,
777 utf8proc_custom_func custom_func, void *custom_data
778) {
779 utf8proc_int32_t *buffer;
780 utf8proc_ssize_t result;
781 *dstptr = NULL;
782 result = utf8proc_decompose_custom(str, strlen, NULL, 0, options, custom_func, custom_data);
783 if (result < 0) return result;
784 buffer = (utf8proc_int32_t *) malloc(((utf8proc_size_t)result) * sizeof(utf8proc_int32_t) + 1);
785 if (!buffer) return UTF8PROC_ERROR_NOMEM;
786 result = utf8proc_decompose_custom(str, strlen, buffer, result, options, custom_func, custom_data);
787 if (result < 0) {
788 free(buffer);
789 return result;
790 }
791 result = utf8proc_reencode(buffer, result, options);
792 if (result < 0) {
793 free(buffer);
794 return result;
795 }
796 {
797 utf8proc_int32_t *newptr;
798 newptr = (utf8proc_int32_t *) realloc(buffer, (size_t)result+1);
799 if (newptr) buffer = newptr;
800 }
801 *dstptr = (utf8proc_uint8_t *)buffer;
802 return result;
803}
804
805UTF8PROC_DLLEXPORT utf8proc_uint8_t *utf8proc_NFD(const utf8proc_uint8_t *str) {
806 utf8proc_uint8_t *retval;

Callers 2

utf8proc_mapFunction · 0.85
mainFunction · 0.85

Calls 2

utf8proc_reencodeFunction · 0.85

Tested by

no test coverage detected