summaryrefslogtreecommitdiff
path: root/regexp.h
diff options
context:
space:
mode:
authorDavid Leadbeater <dgl@dgl.cx>2010-12-07 16:46:53 -0800
committerFather Chrysostomos <sprout@cpan.org>2010-12-07 16:47:44 -0800
commit1af910ea8358b80143d7e7c877436232e1fde3ec (patch)
treeca752e41e926a2ebc37318962e3ca7f59b3ab374 /regexp.h
parentf36626324a6d43051a06d5a6d634a7e98042725b (diff)
downloadperl-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.h15
1 files changed, 6 insertions, 9 deletions
diff --git a/regexp.h b/regexp.h
index 5acdc5e9db..9bba272ad8 100644
--- a/regexp.h
+++ b/regexp.h
@@ -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.