summaryrefslogtreecommitdiff
path: root/pp.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2006-04-16 11:35:38 +0000
committerNicholas Clark <nick@ccl4.org>2006-04-16 11:35:38 +0000
commitc1c21316ed394affd6841f00fb82bc62eb5fd0a5 (patch)
treee6add2e39e912a1f475f3b28e094f78bb1f0e125 /pp.c
parent47518d95dc53ff6c3eab1e57e355d65c518ebfa5 (diff)
downloadperl-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.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/pp.c b/pp.c
index a1f51aa6d0..8914545a07 100644
--- a/pp.c
+++ b/pp.c
@@ -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;