diff options
author | Nicholas Clark <nick@ccl4.org> | 2006-04-16 11:35:38 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2006-04-16 11:35:38 +0000 |
commit | c1c21316ed394affd6841f00fb82bc62eb5fd0a5 (patch) | |
tree | e6add2e39e912a1f475f3b28e094f78bb1f0e125 /pp.c | |
parent | 47518d95dc53ff6c3eab1e57e355d65c518ebfa5 (diff) | |
download | perl-c1c21316ed394affd6841f00fb82bc62eb5fd0a5.tar.gz |
Provide a new flag for sv_usepvn_flags, SV_HAS_TRAILING_NUL, which
signals that the buffer passed in is already well-formed for use as
SvPVX (i.e. it is followed by a trailing NUL), and hence the realloc()
to add a NUL can be skipped.
p4raw-id: //depot/perl@27841
Diffstat (limited to 'pp.c')
-rw-r--r-- | pp.c | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -2458,9 +2458,9 @@ PP(pp_complement) p = uvchr_to_utf8_flags(p, ~c, UNICODE_ALLOW_ANY); } *p = '\0'; - sv_setpvn(TARG, (char*)result, targlen); + sv_usepvn_flags(TARG, (char*)result, targlen, + SV_HAS_TRAILING_NUL); SvUTF8_on(TARG); - Safefree(result); } else { U8 *result; @@ -2474,9 +2474,8 @@ PP(pp_complement) *p++ = ~c; } *p = '\0'; - sv_setpvn(TARG, (char*)result, nchar); + sv_usepvn_flags(TARG, (char*)result, nchar, SV_HAS_TRAILING_NUL); SvUTF8_off(TARG); - Safefree(result); } SETs(TARG); RETURN; |