diff options
author | Nicholas Clark <nick@ccl4.org> | 2009-02-22 22:27:18 +0100 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2009-02-22 22:27:18 +0100 |
commit | 7ffdaae673354e3b3ebbecaecdc009fee9fa90e7 (patch) | |
tree | 793fa9334bff2f0b602302c611c01885ae93a7ac /proto.h | |
parent | 10cc20f60c359ae5d3303fc24a4918518974bc83 (diff) | |
download | perl-7ffdaae673354e3b3ebbecaecdc009fee9fa90e7.tar.gz |
Optimise S_incpush() by avoiding repeatedly copying libdir to subdir.
Specifically, copy it once with newSVsv(), then pass libdir to
S_incpush_if_exists(), and if that creates a new SV, use newSVsv() there to
re-do the copy. Otherwise reset the length of the passed-in SV (which is
subdir), back to the length of libdir, effectively truncating it back to be
equal to libdir. This avoids repeated copying of the same bytes over the same
memory that already holds those bytes.
Diffstat (limited to 'proto.h')
-rw-r--r-- | proto.h | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -4803,11 +4803,12 @@ STATIC void* S_parse_body(pTHX_ char **env, XSINIT_t xsinit); STATIC void S_run_body(pTHX_ I32 oldscope) __attribute__noreturn__; -STATIC SV * S_incpush_if_exists(pTHX_ AV *const av, SV *dir) +STATIC SV * S_incpush_if_exists(pTHX_ AV *const av, SV *dir, SV *const stem) __attribute__nonnull__(pTHX_1) - __attribute__nonnull__(pTHX_2); + __attribute__nonnull__(pTHX_2) + __attribute__nonnull__(pTHX_3); #define PERL_ARGS_ASSERT_INCPUSH_IF_EXISTS \ - assert(av); assert(dir) + assert(av); assert(dir); assert(stem) #endif |