summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2019-01-30 10:52:41 -0700
committerKarl Williamson <khw@cpan.org>2019-02-04 21:00:50 -0700
commit93327b758a54c8e1ff7ee137a513caff4d077a7d (patch)
tree887f6a4a0bd9b8209d21f400425709c5e769972a
parent526f8cbff8ce0a6402d8eb64ac3970e48c8716c3 (diff)
downloadperl-93327b758a54c8e1ff7ee137a513caff4d077a7d.tar.gz
pp.c: Don't use function call for easy copy
This code is adding the UTF-8 for a Greek character to a string. It previously used Copy, but this character is representable as two bytes in both ASCII and EBCDIC UTF-8, the only character sets that Perl will ever supports, so we can use the specialized code that is used most everywhere else for two byte UTF-8 characters, avoiding the function overhead, and having to treat this character as particularly special.
-rw-r--r--pp.c6
-rw-r--r--regen/unicode_constants.pl1
-rw-r--r--unicode_constants.h3
3 files changed, 2 insertions, 8 deletions
diff --git a/pp.c b/pp.c
index 3c7421520a..6191b48761 100644
--- a/pp.c
+++ b/pp.c
@@ -31,9 +31,7 @@
#include "reentr.h"
#include "regcharclass.h"
-static const STRLEN small_mu_len = sizeof(GREEK_SMALL_LETTER_MU_UTF8) - 1;
static const STRLEN capital_iota_len = sizeof(GREEK_CAPITAL_LETTER_IOTA_UTF8) - 1;
-
/* variations on pp_null */
PP(pp_stub)
@@ -4549,8 +4547,8 @@ PP(pp_fc)
(send -s) * 2 + 1);
d = (U8*)SvPVX(dest) + len;
- Copy(GREEK_SMALL_LETTER_MU_UTF8, d, small_mu_len, U8);
- d += small_mu_len;
+ *d++ = UTF8_TWO_BYTE_HI(GREEK_SMALL_LETTER_MU);
+ *d++ = UTF8_TWO_BYTE_LO(GREEK_SMALL_LETTER_MU);
s++;
for (; s < send; s++) {
diff --git a/regen/unicode_constants.pl b/regen/unicode_constants.pl
index 3bddd90ff8..ee7bdb8dcb 100644
--- a/regen/unicode_constants.pl
+++ b/regen/unicode_constants.pl
@@ -242,7 +242,6 @@ U+017F string
U+0300 string
U+0399 string
-U+03BC string
U+1E9E string_skip_if_undef
diff --git a/unicode_constants.h b/unicode_constants.h
index d5a410fc48..dfeaacc7f0 100644
--- a/unicode_constants.h
+++ b/unicode_constants.h
@@ -56,7 +56,6 @@ bytes.
# define COMBINING_GRAVE_ACCENT_UTF8 "\xCC\x80" /* U+0300 */
# define GREEK_CAPITAL_LETTER_IOTA_UTF8 "\xCE\x99" /* U+0399 */
-# define GREEK_SMALL_LETTER_MU_UTF8 "\xCE\xBC" /* U+03BC */
# define LATIN_CAPITAL_LETTER_SHARP_S_UTF8 "\xE1\xBA\x9E" /* U+1E9E */
@@ -101,7 +100,6 @@ bytes.
# define COMBINING_GRAVE_ACCENT_UTF8 "\xAF\x41" /* U+0300 */
# define GREEK_CAPITAL_LETTER_IOTA_UTF8 "\xB3\x68" /* U+0399 */
-# define GREEK_SMALL_LETTER_MU_UTF8 "\xB4\x70" /* U+03BC */
# define LATIN_CAPITAL_LETTER_SHARP_S_UTF8 "\xBF\x63\x72" /* U+1E9E */
@@ -146,7 +144,6 @@ bytes.
# define COMBINING_GRAVE_ACCENT_UTF8 "\xAD\x41" /* U+0300 */
# define GREEK_CAPITAL_LETTER_IOTA_UTF8 "\xB2\x67" /* U+0399 */
-# define GREEK_SMALL_LETTER_MU_UTF8 "\xB3\x6A" /* U+03BC */
# define LATIN_CAPITAL_LETTER_SHARP_S_UTF8 "\xBF\x62\x71" /* U+1E9E */