From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Philipp Stephani
> From: Philipp Stephani <p.stephani2@gmail.com>
> Date: Mon, 25 Dec 2017 22:01:15 +0100
> Cc: Philipp Stephani <phst@google.com>
>
> +/* Return the Unicode code point for the given UTF-16 surrogates.=C2= =A0 */
> +
> +INLINE int
> +surrogates_to_codepoint (int low, int high)
> +{
> +=C2=A0 eassert (char_low_surrogate_p (low));
> +=C2=A0 eassert (char_high_surrogate_p (high));
> +=C2=A0 return 0x10000 + (low - 0xDC00) + ((high - 0xD800) * 0x400); > +}
> +
>=C2=A0 /* Data type for Unicode general category.
Suggest to move surrogates_to_codepoint to coding.c, and then use the
macros UTF_16_HIGH_SURROGATE_P and UTF_16_LOW_SURROGATE_P defined
there.
=C2=A0 A= lso, a single-liner sounds like too little to justify a
function, so maybe make all of that macros in coding.h, and include
the latter in nsterm.m.
> +=C2=A0 USE_SAFE_ALLOCA;
> +=C2=A0 unichar *utf16_buffer;
> +=C2=A0 SAFE_NALLOCA (utf16_buffer, 1, len);
Maximum length of a UTF-16 sequence is known in advance, so why do you
need SAFE_NALLOCA here?=C2=A0 Couldn't you use a buffer of fixed length=
instead?