diff options
author | Nicholas Clark <nick@ccl4.org> | 2011-05-15 14:45:53 +0100 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2011-06-11 10:39:59 +0200 |
commit | 82ff486e3dffdd873d119ab2245448a996948e2d (patch) | |
tree | 9853646997e1cd61fb27786a8f09d11891474cd8 /perl.h | |
parent | e0a73de458fc6a8b96ea80ab0485ce7bdabb4c8b (diff) | |
download | perl-82ff486e3dffdd873d119ab2245448a996948e2d.tar.gz |
In PL_magic_data flag whether magic can be added to a readonly value.
Use this to simplify the logic in Perl_sv_magic().
This introduces a small change of behaviour for error cases involving unknown
magic types. Previously, if Perl_sv_magic() was passed a magic type unknown to
it, it would
1: Croak "Modification of a read-only value attempted" if read only
2: Return without error if the SV happened to already have this magic
3: otherwise croak "Don't know how to handle magic of type \\%o"
Now it will always croak "Don't know how to handle magic of type \\%o", even
on read only values, or SVs which already have the unknown magic type.
Diffstat (limited to 'perl.h')
-rw-r--r-- | perl.h | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -5071,8 +5071,11 @@ START_EXTERN_C # define EXT_MGVTBL EXT MGVTBL #endif +#define PERL_MAGIC_READONLY_ACCEPTABLE 0x40 #define PERL_MAGIC_VALUE_MAGIC 0x80 #define PERL_MAGIC_VTABLE_MASK 0x3F +#define PERL_MAGIC_TYPE_READONLY_ACCEPTABLE(t) \ + (PL_magic_data[(U8)(t)] & PERL_MAGIC_READONLY_ACCEPTABLE) #define PERL_MAGIC_TYPE_IS_VALUE_MAGIC(t) \ (PL_magic_data[(U8)(t)] & PERL_MAGIC_VALUE_MAGIC) |