summaryrefslogtreecommitdiff
path: root/hv.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2007-09-20 12:59:25 +0000
committerNicholas Clark <nick@ccl4.org>2007-09-20 12:59:25 +0000
commit63c893452f9c16b03be0a54c60b062d7e98a4471 (patch)
tree2b46f4fd5714ded00fbea5380060e615bf41a84b /hv.c
parentb8934dab8e60c1d376ff929f8bed2d4864e46219 (diff)
downloadperl-63c893452f9c16b03be0a54c60b062d7e98a4471.tar.gz
Switch Perl_hv_common() to returning void * rather than HE *.
p4raw-id: //depot/perl@31926
Diffstat (limited to 'hv.c')
-rw-r--r--hv.c47
1 files changed, 24 insertions, 23 deletions
diff --git a/hv.c b/hv.c
index 1b8f74c6af..521ce2bb5c 100644
--- a/hv.c
+++ b/hv.c
@@ -253,8 +253,8 @@ Perl_hv_store(pTHX_ HV *hv, const char *key, I32 klen_i32, SV *val, U32 hash)
klen = klen_i32;
flags = 0;
}
- hek = hv_common(hv, NULL, key, klen, flags,
- (HV_FETCH_ISSTORE|HV_FETCH_JUST_SV), val, hash);
+ hek = (HE *) hv_common(hv, NULL, key, klen, flags,
+ (HV_FETCH_ISSTORE|HV_FETCH_JUST_SV), val, hash);
return hek ? &HeVAL(hek) : NULL;
}
@@ -263,8 +263,9 @@ SV**
Perl_hv_store_flags(pTHX_ HV *hv, const char *key, I32 klen, SV *val,
register U32 hash, int flags)
{
- HE * const hek = hv_common(hv, NULL, key, klen, flags,
- (HV_FETCH_ISSTORE|HV_FETCH_JUST_SV), val, hash);
+ HE * const hek = (HE *) hv_common(hv, NULL, key, klen, flags,
+ (HV_FETCH_ISSTORE|HV_FETCH_JUST_SV), val,
+ hash);
return hek ? &HeVAL(hek) : NULL;
}
@@ -351,9 +352,9 @@ Perl_hv_fetch(pTHX_ HV *hv, const char *key, I32 klen_i32, I32 lval)
klen = klen_i32;
flags = 0;
}
- hek = hv_common(hv, NULL, key, klen, flags, lval
- ? (HV_FETCH_JUST_SV | HV_FETCH_LVALUE) : HV_FETCH_JUST_SV,
- NULL, 0);
+ hek = (HE *) hv_common(hv, NULL, key, klen, flags,
+ lval ? (HV_FETCH_JUST_SV | HV_FETCH_LVALUE)
+ : HV_FETCH_JUST_SV, NULL, 0);
return hek ? &HeVAL(hek) : NULL;
}
@@ -386,7 +387,7 @@ information on how to use this function on tied hashes.
=cut
*/
-HE *
+void *
Perl_hv_common(pTHX_ HV *hv, SV *keysv, const char *key, STRLEN klen,
int flags, int action, SV *val, register U32 hash)
{
@@ -498,26 +499,25 @@ Perl_hv_common(pTHX_ HV *hv, SV *keysv, const char *key, STRLEN klen,
const char * const nkey = strupr(savepvn(key,klen));
/* Note that this fetch is for nkey (the uppercased
key) whereas the store is for key (the original) */
- entry = hv_common(hv, NULL, nkey, klen,
- HVhek_FREEKEY, /* free nkey */
- 0 /* non-LVAL fetch */
- | HV_DISABLE_UVAR_XKEY,
- NULL /* no value */,
- 0 /* compute hash */);
+ void *result = hv_common(hv, NULL, nkey, klen,
+ HVhek_FREEKEY, /* free nkey */
+ 0 /* non-LVAL fetch */
+ | HV_DISABLE_UVAR_XKEY,
+ NULL /* no value */,
+ 0 /* compute hash */);
if (!entry && (action & HV_FETCH_LVALUE)) {
/* This call will free key if necessary.
Do it this way to encourage compiler to tail
call optimise. */
- entry = hv_common(hv, keysv, key, klen,
- flags,
- HV_FETCH_ISSTORE
- | HV_DISABLE_UVAR_XKEY,
- newSV(0), hash);
+ result = hv_common(hv, keysv, key, klen, flags,
+ HV_FETCH_ISSTORE
+ | HV_DISABLE_UVAR_XKEY,
+ newSV(0), hash);
} else {
if (flags & HVhek_FREEKEY)
Safefree(key);
}
- return entry;
+ return result;
}
}
#endif
@@ -971,9 +971,10 @@ S_hv_delete_common(pTHX_ HV *hv, SV *keysv, const char *key, STRLEN klen,
if (needs_copy) {
SV *sv;
- entry = hv_common(hv, keysv, key, klen, k_flags & ~HVhek_FREEKEY,
- HV_FETCH_LVALUE|HV_DISABLE_UVAR_XKEY, NULL,
- hash);
+ entry = (HE *) hv_common(hv, keysv, key, klen,
+ k_flags & ~HVhek_FREEKEY,
+ HV_FETCH_LVALUE|HV_DISABLE_UVAR_XKEY,
+ NULL, hash);
sv = entry ? HeVAL(entry) : NULL;
if (sv) {
if (SvMAGICAL(sv)) {