Unfortunately, the historical double meaning of SvREADONLY makes
it hard to do the correct thing under all perl versions.
If this proves too problematic for other XS modules, we might need
to forbid read-only COWs, which would be unfortunate, since they
speed things up.
However, a CPAN search reveals nothing outside core for
READONLY.*?(IsCOW|FAKE).
# define HvTOTALKEYS(hv) HvKEYS(hv)
#endif
+#ifdef SVf_IsCOW
+# define SvTRULYREADONLY(sv) SvREADONLY(sv)
+#else
+# define SvTRULYREADONLY(sv) (SvREADONLY(sv) && !SvIsCOW(sv))
+#endif
+
#ifdef DEBUGME
#ifndef DASSERT
/* Implementation of restricted hashes isn't nicely
abstracted: */
if ((hash_flags & SHV_RESTRICTED)
- && SvREADONLY(val) && !SvIsCOW(val)) {
+ && SvTRULYREADONLY(val)) {
flags |= SHV_K_LOCKED;
}
abstracted: */
flags
= (((hash_flags & SHV_RESTRICTED)
- && SvREADONLY(val) && !SvIsCOW(val))
+ && SvTRULYREADONLY(val))
? SHV_K_LOCKED : 0);
if (val == &PL_sv_placeholder) {