Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion embed.fnc
Original file line number Diff line number Diff line change
Expand Up @@ -1522,7 +1522,7 @@ Cp |void * |hv_common |NULLOK NOCHECK HV *hv \
|int action \
|NULLOK SV *val \
|U32 hash
Cp |void * |hv_common_key_len \
Cip |void * |hv_common_key_len \
|NULLOK HV *hv \
|NN const char *key \
|I32 klen_i32 \
Expand Down
20 changes: 0 additions & 20 deletions hv.c
Original file line number Diff line number Diff line change
Expand Up @@ -461,26 +461,6 @@ information on how to use this function on tied hashes.
=cut
*/

/* Common code for hv_delete()/hv_exists()/hv_fetch()/hv_store() */
void *
Perl_hv_common_key_len(pTHX_ HV *hv, const char *key, I32 klen_i32,
const int action, SV *val, const U32 hash)
{
STRLEN klen;
int flags;

PERL_ARGS_ASSERT_HV_COMMON_KEY_LEN;

if (klen_i32 < 0) {
klen = -klen_i32;
flags = HVhek_UTF8;
} else {
klen = klen_i32;
flags = 0;
}
return hv_common(hv, NULL, key, klen, flags, action, val, hash);
}

void *
Perl_hv_common(pTHX_ HV *hv, SV *keysv, const char *key, STRLEN klen,
int flags, int action, SV *val, U32 hash)
Expand Down
10 changes: 6 additions & 4 deletions hv.h
Original file line number Diff line number Diff line change
Expand Up @@ -558,10 +558,12 @@ whether it is valid to call C<HvAUX()>.
#define hv_exists(hv, key, klen) \
cBOOL(hv_common_key_len((hv), (key), (klen), HV_FETCH_ISEXISTS, NULL, 0))

#define hv_fetch(hv, key, klen, lval) \
((SV**) hv_common_key_len((hv), (key), (klen), (lval) \
? (HV_FETCH_JUST_SV | HV_FETCH_LVALUE) \
: HV_FETCH_JUST_SV, NULL, 0))
#define hv_fetch(hv, key, klen, lval) \
((SV**) hv_common_key_len((hv), (key), (klen), \
(HV_FETCH_JUST_SV | ((lval) \
? HV_FETCH_LVALUE \
: 0)), \
NULL, 0))

#define hv_delete(hv, key, klen, flags) \
(MUTABLE_SV(hv_common_key_len((hv), (key), (klen), \
Expand Down
22 changes: 22 additions & 0 deletions inline.h
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,28 @@ S_strip_spaces(pTHX_ const char * orig, STRLEN * const len)
}
#endif

/* ------------------------------- hv.c ------------------------------- */

/* Common code for hv_delete()/hv_exists()/hv_fetch()/hv_store() */
PERL_STATIC_INLINE void *
Perl_hv_common_key_len(pTHX_ HV *hv, const char *key, I32 klen_i32,
const int action, SV *val, const U32 hash)
{
PERL_ARGS_ASSERT_HV_COMMON_KEY_LEN;

STRLEN klen;
int flags;

if (klen_i32 < 0) {
klen = -klen_i32;
flags = HVhek_UTF8;
} else {
klen = klen_i32;
flags = 0;
}
return hv_common(hv, NULL, key, klen, flags, action, val, hash);
}

/* ------------------------------- iperlsys.h ------------------------------- */
#if ! defined(PERL_IMPLICIT_SYS) && defined(USE_ITHREADS)

Expand Down
10 changes: 5 additions & 5 deletions proto.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading