summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2007-10-05 21:46:39 +0000
committerNicholas Clark <nick@ccl4.org>2007-10-05 21:46:39 +0000
commit73031816b5ef6a74869c06e84bb621841a623d0a (patch)
treed32b5c3fb26957bea1228281382430b00c24179d
parent618b9757aa96db62da872255c9caeb6443086539 (diff)
downloadperl-73031816b5ef6a74869c06e84bb621841a623d0a.tar.gz
Eliminate the Perl_sv_catpvf() in TRIE_STORE_REVCHAR
p4raw-id: //depot/perl@32036
-rw-r--r--regcomp.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/regcomp.c b/regcomp.c
index 8757eb1f6c..b3025611eb 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -1163,11 +1163,19 @@ is the recommended Unicode-aware way of saying
#define TRIE_STORE_REVCHAR \
STMT_START { \
- SV *tmp = newSVpvs(""); \
- if (UTF) SvUTF8_on(tmp); \
- Perl_sv_catpvf( aTHX_ tmp, "%c", (int)uvc ); \
- av_push( revcharmap, tmp ); \
- } STMT_END
+ if (UTF) { \
+ SV *zlopp = newSV(2); \
+ char *flrbbbbb = SvPVX(zlopp); \
+ const char *const kapow = uvuni_to_utf8(flrbbbbb, uvc & 0xFF); \
+ SvCUR_set(zlopp, kapow - flrbbbbb); \
+ SvPOK_on(zlopp); \
+ SvUTF8_on(zlopp); \
+ av_push(revcharmap, zlopp); \
+ } else { \
+ unsigned char ooooff = uvc; \
+ av_push(revcharmap, newSVpvn(&ooooff, 1)); \
+ } \
+ } STMT_END
#define TRIE_READ_CHAR STMT_START { \
wordlen++; \