diff options
Diffstat (limited to 'gnu/usr.bin/perl/XSUB.h')
-rw-r--r-- | gnu/usr.bin/perl/XSUB.h | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/gnu/usr.bin/perl/XSUB.h b/gnu/usr.bin/perl/XSUB.h index af452ea5d77..0b82a270b46 100644 --- a/gnu/usr.bin/perl/XSUB.h +++ b/gnu/usr.bin/perl/XSUB.h @@ -38,19 +38,22 @@ #ifdef XS_VERSION # define XS_VERSION_BOOTCHECK \ - STMT_START { \ - char vn[255], *module = SvPV(ST(0),na); \ - if (items >= 2) /* version supplied as bootstrap arg */ \ - Sv=ST(1); \ - else { /* read version from module::VERSION */ \ - sprintf(vn,"%s::VERSION", module); \ - Sv = perl_get_sv(vn, FALSE); /* XXX GV_ADDWARN */ \ - } \ - if (Sv && (!SvOK(Sv) || strNE(XS_VERSION, SvPV(Sv,na))) ) \ - croak("%s object version %s does not match %s.pm $VERSION %s", \ - module,XS_VERSION, module,(Sv && SvOK(Sv))?SvPV(Sv,na):"(undef)");\ + STMT_START { \ + char *vn = "", *module = SvPV(ST(0),na); \ + if (items >= 2) /* version supplied as bootstrap arg */ \ + Sv = ST(1); \ + else { \ + /* XXX GV_ADDWARN */ \ + Sv = perl_get_sv(form("%s::%s", module, \ + vn = "XS_VERSION"), FALSE); \ + if (!Sv || !SvOK(Sv)) \ + Sv = perl_get_sv(form("%s::%s", module, \ + vn = "VERSION"), FALSE); \ + } \ + if (Sv && (!SvOK(Sv) || strNE(XS_VERSION, SvPV(Sv, na)))) \ + croak("%s object version %s does not match $%s::%s %_", \ + module, XS_VERSION, module, vn, Sv); \ } STMT_END #else # define XS_VERSION_BOOTCHECK #endif - |