From 52153d39731a5803b1b30f13562073021edde1ac Mon Sep 17 00:00:00 2001 From: Ivan Date: Tue, 24 Nov 2026 23:20:22 +1100 Subject: [PATCH] Document custom mapping callback consistency requirements --- utf8proc.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/utf8proc.h b/utf8proc.h index d842f6b..45af462 100644 --- a/utf8proc.h +++ b/utf8proc.h @@ -765,6 +765,12 @@ UTF8PROC_DLLEXPORT utf8proc_ssize_t utf8proc_map( * that is called on each codepoint in `str` before any other transformations * (along with a `custom_data` pointer that is passed through to `custom_func`). * The `custom_func` argument is ignored if it is `NULL`. + * + * @note `custom_func` may be called more than once for each input codepoint. + * It must return the same replacement for a given codepoint, independently of + * the number or order of calls. Caching results in `custom_data` is allowed if + * it does not change the mapping. Context-dependent transformations should be + * applied to the input before calling this function. */ UTF8PROC_DLLEXPORT utf8proc_ssize_t utf8proc_map_custom( const utf8proc_uint8_t *str, utf8proc_ssize_t strlen, utf8proc_uint8_t **dstptr, unsigned int options,