From b96d8cd966afa49291119752aac86cd1f1de5560 Mon Sep 17 00:00:00 2001 From: Nicholas Clark Date: Wed, 21 Jan 2009 16:41:58 +0000 Subject: Add get_cvs() as a shortcut for STR_WITH_LEN() and Perl_get_cvn_flags(), and use it where possible. --- ext/Devel/DProf/DProf.xs | 2 +- ext/DynaLoader/dlutils.c | 2 +- ext/PerlIO/encoding/encoding.xs | 2 +- handy.h | 2 ++ op.c | 3 +-- perlio.c | 2 +- pp_ctl.c | 4 ++-- 7 files changed, 9 insertions(+), 8 deletions(-) diff --git a/ext/Devel/DProf/DProf.xs b/ext/Devel/DProf/DProf.xs index e3faa4a697..ea36b2408a 100644 --- a/ext/Devel/DProf/DProf.xs +++ b/ext/Devel/DProf/DProf.xs @@ -470,7 +470,7 @@ prof_mark(pTHX_ opcode ptype) static void test_time(pTHX_ clock_t *r, clock_t *u, clock_t *s) { - CV * const cv = perl_get_cv("Devel::DProf::NONESUCH_noxs", 0); + CV * const cv = get_cvs("Devel::DProf::NONESUCH_noxs", 0); HV * const oldstash = PL_curstash; struct tms t1, t2; const U32 ototal = g_total; diff --git a/ext/DynaLoader/dlutils.c b/ext/DynaLoader/dlutils.c index 82818a96d4..1ba9a61b48 100644 --- a/ext/DynaLoader/dlutils.c +++ b/ext/DynaLoader/dlutils.c @@ -68,7 +68,7 @@ dl_unload_all_files(pTHX_ void *unused) AV *dl_librefs; SV *dl_libref; - if ((sub = get_cv("DynaLoader::dl_unload_file", 0)) != NULL) { + if ((sub = get_cvs("DynaLoader::dl_unload_file", 0)) != NULL) { dl_librefs = get_av("DynaLoader::dl_librefs", 0); while ((dl_libref = av_pop(dl_librefs)) != &PL_sv_undef) { dSP; diff --git a/ext/PerlIO/encoding/encoding.xs b/ext/PerlIO/encoding/encoding.xs index f1b074235c..dc6981979c 100644 --- a/ext/PerlIO/encoding/encoding.xs +++ b/ext/PerlIO/encoding/encoding.xs @@ -639,7 +639,7 @@ BOOT: */ PUSHSTACKi(PERLSI_MAGIC); SPAGAIN; - if (!get_cv(OUR_DEFAULT_FB, 0)) { + if (!get_cvs(OUR_DEFAULT_FB, 0)) { #if 0 /* This would just be an irritant now loading works */ Perl_warner(aTHX_ packWARN(WARN_IO), ":encoding without 'use Encode'"); diff --git a/handy.h b/handy.h index e82a644071..75080cb641 100644 --- a/handy.h +++ b/handy.h @@ -327,6 +327,8 @@ and omits the hash parameter. ((SV **)Perl_hv_common(aTHX_ (hv), NULL, STR_WITH_LEN(key), 0, \ (HV_FETCH_ISSTORE|HV_FETCH_JUST_SV), (val), 0)) +#define get_cvs(str, flags) \ + Perl_get_cvn_flags(aTHX_ STR_WITH_LEN(str), (flags)) /* =head1 Miscellaneous Functions diff --git a/op.c b/op.c index e32cbdb4c6..5103efb215 100644 --- a/op.c +++ b/op.c @@ -2338,8 +2338,7 @@ Perl_newPROG(pTHX_ OP *o) /* Register with debugger */ if (PERLDB_INTER) { - CV * const cv - = Perl_get_cvn_flags(aTHX_ STR_WITH_LEN("DB::postponed"), 0); + CV * const cv = get_cvs("DB::postponed", 0); if (cv) { dSP; PUSHMARK(SP); diff --git a/perlio.c b/perlio.c index 5db65b931a..b935734e4c 100644 --- a/perlio.c +++ b/perlio.c @@ -807,7 +807,7 @@ PerlIO_find_layer(pTHX_ const char *name, STRLEN len, int load) } else { SV * const pkgsv = newSVpvs("PerlIO"); SV * const layer = newSVpvn(name, len); - CV * const cv = Perl_get_cvn_flags(aTHX_ STR_WITH_LEN("PerlIO::Layer::NoWarnings"), 0); + CV * const cv = get_cvs("PerlIO::Layer::NoWarnings", 0); ENTER; SAVEINT(PL_in_load_module); if (cv) { diff --git a/pp_ctl.c b/pp_ctl.c index e788197e7d..f118d57c60 100644 --- a/pp_ctl.c +++ b/pp_ctl.c @@ -2575,7 +2575,7 @@ PP(pp_goto) if (PERLDB_SUB) { /* Checking curstash breaks DProf. */ Perl_get_db_sub(aTHX_ NULL, cv); if (PERLDB_GOTO) { - CV * const gotocv = get_cv("DB::goto", 0); + CV * const gotocv = get_cvs("DB::goto", 0); if (gotocv) { PUSHMARK( PL_stack_sp ); call_sv(MUTABLE_SV(gotocv), G_SCALAR | G_NODEBUG); @@ -3098,7 +3098,7 @@ S_doeval(pTHX_ int gimme, OP** startop, CV* outside, U32 seq) /* Register with debugger: */ if (PERLDB_INTER && saveop && saveop->op_type == OP_REQUIRE) { - CV * const cv = get_cv("DB::postponed", 0); + CV * const cv = get_cvs("DB::postponed", 0); if (cv) { dSP; PUSHMARK(SP); -- cgit v1.2.1