From 07693fe64de170ae254d8e190ac8c1f51869bc3c Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Tue, 30 Apr 2013 08:04:45 -0600 Subject: [PATCH] utf8.c: Move 2 functions to earlier in file This moves these two functions to be adjacent to the function they each call, thus keeping like things together. --- utf8.c | 72 +++++++++++++++++++++++++++++++++--------------------------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/utf8.c b/utf8.c index 7e87a0d..e738801 100644 --- a/utf8.c +++ b/utf8.c @@ -264,6 +264,42 @@ Perl_uvoffuni_to_utf8_flags(pTHX_ U8 *d, UV uv, UV flags) } /* +=for apidoc uvchr_to_utf8 + +Adds the UTF-8 representation of the Native code point C to the end +of the string C; C should have at least C free +bytes available. The return value is the pointer to the byte after the +end of the new character. In other words, + + d = uvchr_to_utf8(d, uv); + +is the recommended wide native character-aware way of saying + + *(d++) = uv; + +=cut +*/ + +/* On ASCII machines this is normally a macro but we want a + real function in case XS code wants it +*/ +U8 * +Perl_uvchr_to_utf8(pTHX_ U8 *d, UV uv) +{ + PERL_ARGS_ASSERT_UVCHR_TO_UTF8; + + return Perl_uvoffuni_to_utf8_flags(aTHX_ d, NATIVE_TO_UNI(uv), 0); +} + +U8 * +Perl_uvchr_to_utf8_flags(pTHX_ U8 *d, UV uv, UV flags) +{ + PERL_ARGS_ASSERT_UVCHR_TO_UTF8_FLAGS; + + return Perl_uvoffuni_to_utf8_flags(aTHX_ d, NATIVE_TO_UNI(uv), flags); +} + +/* Tests if the first C bytes of string C form a valid UTF-8 character. Note that an INVARIANT (i.e. ASCII) character is a valid @@ -4216,42 +4252,6 @@ Perl__get_swash_invlist(pTHX_ SV* const swash) } /* -=for apidoc uvchr_to_utf8 - -Adds the UTF-8 representation of the Native code point C to the end -of the string C; C should have at least C free -bytes available. The return value is the pointer to the byte after the -end of the new character. In other words, - - d = uvchr_to_utf8(d, uv); - -is the recommended wide native character-aware way of saying - - *(d++) = uv; - -=cut -*/ - -/* On ASCII machines this is normally a macro but we want a - real function in case XS code wants it -*/ -U8 * -Perl_uvchr_to_utf8(pTHX_ U8 *d, UV uv) -{ - PERL_ARGS_ASSERT_UVCHR_TO_UTF8; - - return Perl_uvoffuni_to_utf8_flags(aTHX_ d, NATIVE_TO_UNI(uv), 0); -} - -U8 * -Perl_uvchr_to_utf8_flags(pTHX_ U8 *d, UV uv, UV flags) -{ - PERL_ARGS_ASSERT_UVCHR_TO_UTF8_FLAGS; - - return Perl_uvoffuni_to_utf8_flags(aTHX_ d, NATIVE_TO_UNI(uv), flags); -} - -/* =for apidoc utf8n_to_uvchr Returns the native character value of the first character in the string -- 2.7.4