summaryrefslogtreecommitdiff
path: root/hv.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2006-04-10 17:48:04 +0000
committerNicholas Clark <nick@ccl4.org>2006-04-10 17:48:04 +0000
commit35ab56323549cd3c972fa3918e0e9a2875081466 (patch)
tree8b2adbc7f8e301aa45bd5f3629d72580eccbe203 /hv.c
parent3a0215655ddb64c6c5b60e04e0cd8e1b246bdba5 (diff)
downloadperl-35ab56323549cd3c972fa3918e0e9a2875081466.tar.gz
Perl_unsharepvn() was no longer being used in core, and changes to
S_unshare_hek_or_pvn() had broken it. Now fixed and tested. p4raw-id: //depot/perl@27761
Diffstat (limited to 'hv.c')
-rw-r--r--hv.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/hv.c b/hv.c
index fe74e87849..bc64df4c68 100644
--- a/hv.c
+++ b/hv.c
@@ -2307,7 +2307,6 @@ S_unshare_hek_or_pvn(pTHX_ const HEK *hek, const char *str, I32 len, U32 hash)
HE *entry;
register HE **oentry;
HE **first;
- bool found = 0;
bool is_utf8 = FALSE;
int k_flags = 0;
const char * const save = str;
@@ -2356,10 +2355,8 @@ S_unshare_hek_or_pvn(pTHX_ const HEK *hek, const char *str, I32 len, U32 hash)
if (he) {
const HE *const he_he = &(he->shared_he_he);
for (entry = *oentry; entry; oentry = &HeNEXT(entry), entry = *oentry) {
- if (entry != he_he)
- continue;
- found = 1;
- break;
+ if (entry == he_he)
+ break;
}
} else {
const int flags_masked = k_flags & HVhek_MASK;
@@ -2372,13 +2369,12 @@ S_unshare_hek_or_pvn(pTHX_ const HEK *hek, const char *str, I32 len, U32 hash)
continue;
if (HeKFLAGS(entry) != flags_masked)
continue;
- found = 1;
break;
}
}
- if (found) {
- if (--he->shared_he_he.he_valu.hent_refcount == 0) {
+ if (entry) {
+ if (--entry->he_valu.hent_refcount == 0) {
*oentry = HeNEXT(entry);
if (!*first) {
/* There are now no entries in our slot. */
@@ -2390,7 +2386,7 @@ S_unshare_hek_or_pvn(pTHX_ const HEK *hek, const char *str, I32 len, U32 hash)
}
UNLOCK_STRTAB_MUTEX;
- if (!found && ckWARN_d(WARN_INTERNAL))
+ if (!entry && ckWARN_d(WARN_INTERNAL))
Perl_warner(aTHX_ packWARN(WARN_INTERNAL),
"Attempt to free non-existent shared string '%s'%s"
pTHX__FORMAT,