Skip to content

Commit b9c32dc

Browse files
committed
hv.c: White-space only
The indentation for some lines in one function was only 2 spaces. Remove trailing blanks And This will minimize the diff listing in the next commit when white space isn't ignored.
1 parent 15d8147 commit b9c32dc

File tree

1 file changed

+43
-42
lines changed

1 file changed

+43
-42
lines changed

hv.c

Lines changed: 43 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* [p.278 of _The Lord of the Rings_, II/iii: "The Ring Goes South"]
1717
*/
1818

19-
/*
19+
/*
2020
=head1 HV Handling
2121
A HV structure represents a Perl hash. It consists mainly of an array
2222
of pointers, each of which points to a linked list of HE structures. The
@@ -513,7 +513,7 @@ Perl_hv_common(pTHX_ HV *hv, SV *keysv, const char *key, STRLEN klen,
513513
((flags & HVhek_UTF8)
514514
? SVf_UTF8 : 0));
515515
}
516-
516+
517517
mg->mg_obj = keysv; /* pass key */
518518
uf->uf_index = action; /* pass action */
519519
magic_getuvar(MUTABLE_SV(hv), mg);
@@ -763,24 +763,25 @@ Perl_hv_common(pTHX_ HV *hv, SV *keysv, const char *key, STRLEN klen,
763763
}
764764

765765
if (is_utf8 && !(flags & HVhek_KEYCANONICAL)) {
766-
char * const keysave = (char *)key;
767-
key = (char*)bytes_from_utf8((U8*)key, &klen, &is_utf8);
768-
if (is_utf8)
769-
flags |= HVhek_UTF8;
770-
else
771-
flags &= ~HVhek_UTF8;
772-
if (key != keysave) {
773-
if (flags & HVhek_FREEKEY)
774-
Safefree(keysave);
775-
flags |= HVhek_WASUTF8 | HVhek_FREEKEY;
776-
/* If the caller calculated a hash, it was on the sequence of
777-
octets that are the UTF-8 form. We've now changed the sequence
778-
of octets stored to that of the equivalent byte representation,
779-
so the hash we need is different. */
780-
hash = 0;
781-
}
766+
char * const keysave = (char *)key;
767+
key = (char*)bytes_from_utf8((U8*)key, &klen, &is_utf8);
768+
if (is_utf8)
769+
flags |= HVhek_UTF8;
770+
else
771+
flags &= ~HVhek_UTF8;
772+
if (key != keysave) {
773+
if (flags & HVhek_FREEKEY)
774+
Safefree(keysave);
775+
flags |= HVhek_WASUTF8 | HVhek_FREEKEY;
776+
/* If the caller calculated a hash, it was on the sequence of
777+
* octets that are the UTF-8 form. We've now changed the
778+
* sequence of octets stored to that of the equivalent byte
779+
* representation, so the hash we need is different. */
780+
hash = 0;
781+
}
782782
}
783783

784+
784785
if (keysv && (SvIsCOW_shared_hash(keysv))) {
785786
if (HvSHAREKEYS(hv))
786787
keysv_hek = SvSHARED_HEK_FROM_PV(SvPVX_const(keysv));
@@ -912,7 +913,7 @@ Perl_hv_common(pTHX_ HV *hv, SV *keysv, const char *key, STRLEN klen,
912913

913914
not_found:
914915
#ifdef DYNAMIC_ENV_FETCH /* %ENV lookup? If so, try to fetch the value now */
915-
if (!(action & HV_FETCH_ISSTORE)
916+
if (!(action & HV_FETCH_ISSTORE)
916917
&& SvRMAGICAL((const SV *)hv)
917918
&& mg_find((const SV *)hv, PERL_MAGIC_env)) {
918919
unsigned long len;
@@ -1245,7 +1246,7 @@ Perl_hv_bucket_ratio(pTHX_ HV *hv)
12451246
}
12461247
else
12471248
sv = &PL_sv_zero;
1248-
1249+
12491250
return sv;
12501251
}
12511252

@@ -1458,7 +1459,7 @@ S_hv_delete_common(pTHX_ HV *hv, SV *keysv, const char *key, STRLEN klen,
14581459
HvHASKFLAGS_off(hv);
14591460
}
14601461

1461-
/* If this is a stash and the key ends with ::, then someone is
1462+
/* If this is a stash and the key ends with ::, then someone is
14621463
* deleting a package.
14631464
*/
14641465
if (sv && SvTYPE(sv) == SVt_PVGV && HvHasENAME(hv)) {
@@ -2761,7 +2762,7 @@ Perl_hv_ename_add(pTHX_ HV *hv, const char *name, U32 len, U32 flags)
27612762
{
27622763
assert(*hekp);
27632764
if (
2764-
(HEK_UTF8(*hekp) || (flags & SVf_UTF8))
2765+
(HEK_UTF8(*hekp) || (flags & SVf_UTF8))
27652766
? hek_eq_pvn_flags(aTHX_ *hekp, name, (I32)len, flags)
27662767
: (HEK_LEN(*hekp) == (I32)len && memEQ(HEK_KEY(*hekp), name, len))
27672768
) {
@@ -2824,7 +2825,7 @@ Perl_hv_ename_delete(pTHX_ HV *hv, const char *name, U32 len, U32 flags)
28242825
HEK **victim = namep + (count < 0 ? -count : count);
28252826
while (victim-- > namep + 1)
28262827
if (
2827-
(HEK_UTF8(*victim) || (flags & SVf_UTF8))
2828+
(HEK_UTF8(*victim) || (flags & SVf_UTF8))
28282829
? hek_eq_pvn_flags(aTHX_ *victim, name, (I32)len, flags)
28292830
: (HEK_LEN(*victim) == (I32)len && memEQ(HEK_KEY(*victim), name, len))
28302831
) {
@@ -2847,7 +2848,7 @@ Perl_hv_ename_delete(pTHX_ HV *hv, const char *name, U32 len, U32 flags)
28472848
return;
28482849
}
28492850
if (
2850-
count > 0 && ((HEK_UTF8(*namep) || (flags & SVf_UTF8))
2851+
count > 0 && ((HEK_UTF8(*namep) || (flags & SVf_UTF8))
28512852
? hek_eq_pvn_flags(aTHX_ *namep, name, (I32)len, flags)
28522853
: (HEK_LEN(*namep) == (I32)len && memEQ(HEK_KEY(*namep), name, len))
28532854
)
@@ -2856,7 +2857,7 @@ Perl_hv_ename_delete(pTHX_ HV *hv, const char *name, U32 len, U32 flags)
28562857
}
28572858
}
28582859
else if(
2859-
(HEK_UTF8(aux->xhv_name_u.xhvnameu_name) || (flags & SVf_UTF8))
2860+
(HEK_UTF8(aux->xhv_name_u.xhvnameu_name) || (flags & SVf_UTF8))
28602861
? hek_eq_pvn_flags(aTHX_ aux->xhv_name_u.xhvnameu_name, name, (I32)len, flags)
28612862
: (HEK_LEN(aux->xhv_name_u.xhvnameu_name) == (I32)len &&
28622863
memEQ(HEK_KEY(aux->xhv_name_u.xhvnameu_name), name, len))
@@ -3343,22 +3344,22 @@ Perl_share_hek(pTHX_ const char *str, SSize_t len, U32 hash)
33433344
PERL_ARGS_ASSERT_SHARE_HEK;
33443345

33453346
if (len < 0) {
3346-
STRLEN tmplen = -len;
3347-
is_utf8 = TRUE;
3348-
/* See the note in hv_fetch(). --jhi */
3349-
str = (char*)bytes_from_utf8((U8*)str, &tmplen, &is_utf8);
3350-
len = tmplen;
3351-
/* If we were able to downgrade here, then than means that we were passed
3352-
in a key which only had chars 0-255, but was utf8 encoded. */
3353-
if (is_utf8)
3354-
flags = HVhek_UTF8;
3355-
/* If we found we were able to downgrade the string to bytes, then
3356-
we should flag that it needs upgrading on keys or each. Also flag
3357-
that we need share_hek_flags to free the string. */
3358-
if (str != save) {
3359-
PERL_HASH(hash, str, len);
3360-
flags |= HVhek_WASUTF8 | HVhek_FREEKEY;
3361-
}
3347+
STRLEN tmplen = -len;
3348+
is_utf8 = TRUE;
3349+
/* See the note in hv_fetch(). --jhi */
3350+
str = (char*)bytes_from_utf8((U8*)str, &tmplen, &is_utf8);
3351+
len = tmplen;
3352+
/* If we were able to downgrade here, then than means that we were passed
3353+
in a key which only had chars 0-255, but was utf8 encoded. */
3354+
if (is_utf8)
3355+
flags = HVhek_UTF8;
3356+
/* If we found we were able to downgrade the string to bytes, then
3357+
we should flag that it needs upgrading on keys or each. Also flag
3358+
that we need share_hek_flags to free the string. */
3359+
if (str != save) {
3360+
PERL_HASH(hash, str, len);
3361+
flags |= HVhek_WASUTF8 | HVhek_FREEKEY;
3362+
}
33623363
}
33633364

33643365
return share_hek_flags (str, len, hash, flags);
@@ -4008,7 +4009,7 @@ Perl_refcounted_he_free(pTHX_ struct refcounted_he *he) {
40084009
HINTS_REFCNT_LOCK;
40094010
new_count = --he->refcounted_he_refcnt;
40104011
HINTS_REFCNT_UNLOCK;
4011-
4012+
40124013
if (new_count) {
40134014
return;
40144015
}

0 commit comments

Comments
 (0)