diff options
author | David Leadbeater <dgl@dgl.cx> | 2010-12-07 16:46:53 -0800 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2010-12-07 16:47:44 -0800 |
commit | 1af910ea8358b80143d7e7c877436232e1fde3ec (patch) | |
tree | ca752e41e926a2ebc37318962e3ca7f59b3ab374 /regexp.h | |
parent | f36626324a6d43051a06d5a6d634a7e98042725b (diff) | |
download | perl-1af910ea8358b80143d7e7c877436232e1fde3ec.tar.gz |
The docs for SvRX and SvRXOK still refered to magic and the code snippet
was wrong.
Diffstat (limited to 'regexp.h')
-rw-r--r-- | regexp.h | 15 |
1 files changed, 6 insertions, 9 deletions
@@ -190,20 +190,17 @@ equivalent to the following snippet: if (SvMAGICAL(sv)) mg_get(sv); - if (SvROK(sv) && - (tmpsv = (SV*)SvRV(sv)) && - SvTYPE(tmpsv) == SVt_PVMG && - (tmpmg = mg_find(tmpsv, PERL_MAGIC_qr))) - { - return (REGEXP *)tmpmg->mg_obj; - } + if (SvROK(sv)) + sv = MUTABLE_SV(SvRV(sv)); + if (SvTYPE(sv) == SVt_REGEXP) + return (REGEXP*) sv; NULL will be returned if a REGEXP* is not found. =for apidoc Am|bool|SvRXOK|SV* sv -Returns a boolean indicating whether the SV contains qr magic -(PERL_MAGIC_qr). +Returns a boolean indicating whether the SV (or the one it references) +is a REGEXP. If you want to do something with the REGEXP* later use SvRX instead and check for NULL. |