Skip to content

Commit 85edd14

Browse files
committed
Inline hv_common_key_len()
This tiny function is called as an intermediary from several frequently used macros.
1 parent 80f8746 commit 85edd14

File tree

4 files changed

+28
-26
lines changed

4 files changed

+28
-26
lines changed

embed.fnc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1522,7 +1522,7 @@ Cp |void * |hv_common |NULLOK NOCHECK HV *hv \
15221522
|int action \
15231523
|NULLOK SV *val \
15241524
|U32 hash
1525-
Cp |void * |hv_common_key_len \
1525+
Cip |void * |hv_common_key_len \
15261526
|NULLOK HV *hv \
15271527
|NN const char *key \
15281528
|I32 klen_i32 \

hv.c

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -461,26 +461,6 @@ information on how to use this function on tied hashes.
461461
=cut
462462
*/
463463

464-
/* Common code for hv_delete()/hv_exists()/hv_fetch()/hv_store() */
465-
void *
466-
Perl_hv_common_key_len(pTHX_ HV *hv, const char *key, I32 klen_i32,
467-
const int action, SV *val, const U32 hash)
468-
{
469-
STRLEN klen;
470-
int flags;
471-
472-
PERL_ARGS_ASSERT_HV_COMMON_KEY_LEN;
473-
474-
if (klen_i32 < 0) {
475-
klen = -klen_i32;
476-
flags = HVhek_UTF8;
477-
} else {
478-
klen = klen_i32;
479-
flags = 0;
480-
}
481-
return hv_common(hv, NULL, key, klen, flags, action, val, hash);
482-
}
483-
484464
void *
485465
Perl_hv_common(pTHX_ HV *hv, SV *keysv, const char *key, STRLEN klen,
486466
int flags, int action, SV *val, U32 hash)

inline.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,28 @@ S_strip_spaces(pTHX_ const char * orig, STRLEN * const len)
291291
}
292292
#endif
293293

294+
/* ------------------------------- hv.c ------------------------------- */
295+
296+
/* Common code for hv_delete()/hv_exists()/hv_fetch()/hv_store() */
297+
PERL_STATIC_INLINE void *
298+
Perl_hv_common_key_len(pTHX_ HV *hv, const char *key, I32 klen_i32,
299+
const int action, SV *val, const U32 hash)
300+
{
301+
PERL_ARGS_ASSERT_HV_COMMON_KEY_LEN;
302+
303+
STRLEN klen;
304+
int flags;
305+
306+
if (klen_i32 < 0) {
307+
klen = -klen_i32;
308+
flags = HVhek_UTF8;
309+
} else {
310+
klen = klen_i32;
311+
flags = 0;
312+
}
313+
return hv_common(hv, NULL, key, klen, flags, action, val, hash);
314+
}
315+
294316
/* ------------------------------- iperlsys.h ------------------------------- */
295317
#if ! defined(PERL_IMPLICIT_SYS) && defined(USE_ITHREADS)
296318

proto.h

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)