diff options
author | Nicholas Clark <nick@ccl4.org> | 2005-06-12 21:08:33 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2005-06-12 21:08:33 +0000 |
commit | 29404ae038d75e5ffd5727a026889b0987db9cd5 (patch) | |
tree | 0e2f739fb212e0022a4e4bcfa7d219c5e6edb01b /hv.c | |
parent | cbae396092f5aa3ab7374d8414eb06704dfb41d6 (diff) | |
download | perl-29404ae038d75e5ffd5727a026889b0987db9cd5.tar.gz |
Shortcut chasing round strtab when we're not the last reference.
p4raw-id: //depot/perl@24809
Diffstat (limited to 'hv.c')
-rw-r--r-- | hv.c | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -2170,6 +2170,15 @@ S_unshare_hek_or_pvn(pTHX_ const HEK *hek, const char *str, I32 len, U32 hash) /* Assert that the caller passed us a genuine (or at least consistent) shared hek */ assert (he->shared_he_he.hent_hek == hek); + + LOCK_STRTAB_MUTEX; + if (he->shared_he_he.hent_val - 1) { + --he->shared_he_he.hent_val; + UNLOCK_STRTAB_MUTEX; + return; + } + UNLOCK_STRTAB_MUTEX; + hash = HEK_HASH(hek); } else if (len < 0) { STRLEN tmplen = -len; |