# New Ticket Created by David Leadbeater # Please include the string: [perl #80262] # in the subject line of all future correspondence about this issue. # <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=80262 > From: David Leadbeater <dgl@dgl.cx> The docs for SvRX and SvRXOK still refered to magic and the code snippet was wrong. --- regexp.h | 15 ++++++--------- 1 files changed, 6 insertions(+), 9 deletions(-) diff --git a/regexp.h b/regexp.h index 5acdc5e..9bba272 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. -- 1.7.3.2Thread Previous