diff options
author | Nicholas Clark <nick@ccl4.org> | 2008-04-07 11:29:51 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2008-04-07 11:29:51 +0000 |
commit | dca6062a863d0e957d067cc75f9e13b2e28b1090 (patch) | |
tree | ba5e82876236d273b32dfcb60607b1a1eefe679a /hv.c | |
parent | b1cf8b36002caf0ed4905946652ecfd99208858c (diff) | |
download | perl-dca6062a863d0e957d067cc75f9e13b2e28b1090.tar.gz |
Eliminate cop_label from struct cop by storing a label as the first
entry in the hints hash. Most statements don't have labels, so this
will save memory. Not sure how much.
p4raw-id: //depot/perl@33656
Diffstat (limited to 'hv.c')
-rw-r--r-- | hv.c | 25 |
1 files changed, 25 insertions, 0 deletions
@@ -2878,6 +2878,31 @@ Perl_refcounted_he_free(pTHX_ struct refcounted_he *he) { } } +const char * +Perl_fetch_cop_label(pTHX_ struct refcounted_he *const chain, STRLEN *len, + U32 *flags) { + if (!chain) + return NULL; +#ifdef USE_ITHREADS + if (chain->refcounted_he_keylen != 1) + return NULL; + if (*REF_HE_KEY(chain) != ':') + return NULL; +#else + if ((STRLEN)HEK_LEN(chain->refcounted_he_hek) != 1) + return NULL; + if (*HEK_KEY(chain->refcounted_he_hek) != ':') + return NULL; +#endif + if (len) + *len = chain->refcounted_he_val.refcounted_he_u_len; + if (flags) { + *flags = ((chain->refcounted_he_data[0] & HVrhek_typemask) + == HVrhek_PV_UTF8) ? SVf_UTF8 : 0; + } + return chain->refcounted_he_data + 1; +} + /* =for apidoc hv_assert |