diff options
author | Nicholas Clark <nick@ccl4.org> | 2005-04-18 21:58:22 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2005-04-18 21:58:22 +0000 |
commit | 1da4ca5ff65374ad6965719e5eb33e3027a745a7 (patch) | |
tree | 378c39cf08d231c303fffa124644ea3300e1f46a /sv.h | |
parent | b7e9a5c2d751f7ed3b8a703e57ac933ded5b16ce (diff) | |
download | perl-1da4ca5ff65374ad6965719e5eb33e3027a745a7.tar.gz |
SvPV_renew also calls SvLEN_set
Add SvPV_shrink_to_cur(sv) to call SvPV_renew with SvCUR(sv)+1.
For Ponie this can be a single call into the PMC
p4raw-id: //depot/perl@24245
Diffstat (limited to 'sv.h')
-rw-r--r-- | sv.h | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -794,8 +794,16 @@ in gv.h: */ (SvCUR(sv) = (val) - SvPVX(sv)); } STMT_END #define SvPV_renew(sv,n) \ - (SvPV_set((sv), (MEM_WRAP_CHECK_(n,char) \ - (char*)saferealloc((Malloc_t)SvPVX(sv),(MEM_SIZE)((n)))))) + STMT_START { SvLEN_set(sv, n); \ + SvPV_set((sv), (MEM_WRAP_CHECK_(n,char) \ + (char*)saferealloc((Malloc_t)SvPVX(sv), \ + (MEM_SIZE)((n))))); \ + } STMT_END + +#define SvPV_shrink_to_cur(sv) STMT_START { \ + const STRLEN _lEnGtH = SvCUR(sv) + 1; \ + SvPV_renew(sv, _lEnGtH); \ + } STMT_END #define BmRARE(sv) ((XPVBM*) SvANY(sv))->xbm_rare #define BmUSEFUL(sv) ((XPVBM*) SvANY(sv))->xbm_useful |