From: Gisle Aas Date: Wed, 11 Jan 2006 21:09:19 +0000 (+0000) Subject: A few more places that can use hv_fetchs(). X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=017a3ce5a449d7513ebed2de872ff4d966fd0b43;p=p5sagit%2Fp5-mst-13.2.git A few more places that can use hv_fetchs(). Ref change 26676. p4raw-id: //depot/perl@26795 --- diff --git a/ext/POSIX/POSIX.xs b/ext/POSIX/POSIX.xs index 36b24d9..1edc62b 100644 --- a/ext/POSIX/POSIX.xs +++ b/ext/POSIX/POSIX.xs @@ -1317,7 +1317,7 @@ sigaction(sig, optaction, oldaction = 0) /* Remember old disposition if desired. */ if (oldaction) { - svp = hv_fetch(oldaction, "HANDLER", 7, TRUE); + svp = hv_fetchs(oldaction, "HANDLER", TRUE); if(!svp) croak("Can't supply an oldaction without a HANDLER"); if(SvTRUE(*sigsvp)) { /* TBD: what if "0"? */ @@ -1330,7 +1330,7 @@ sigaction(sig, optaction, oldaction = 0) if(RETVAL == -1) XSRETURN_UNDEF; /* Get back the mask. */ - svp = hv_fetch(oldaction, "MASK", 4, TRUE); + svp = hv_fetchs(oldaction, "MASK", TRUE); if (sv_isa(*svp, "POSIX::SigSet")) { IV tmp = SvIV((SV*)SvRV(*svp)); sigset = INT2PTR(sigset_t*, tmp); @@ -1342,11 +1342,11 @@ sigaction(sig, optaction, oldaction = 0) *sigset = oact.sa_mask; /* Get back the flags. */ - svp = hv_fetch(oldaction, "FLAGS", 5, TRUE); + svp = hv_fetchs(oldaction, "FLAGS", TRUE); sv_setiv(*svp, oact.sa_flags); /* Get back whether the old handler used safe signals. */ - svp = hv_fetch(oldaction, "SAFE", 4, TRUE); + svp = hv_fetchs(oldaction, "SAFE", TRUE); sv_setiv(*svp, /* compare incompatible pointers by casting to integer */ PTR2nat(oact.sa_handler) == PTR2nat(PL_csighandlerp)); @@ -1356,7 +1356,7 @@ sigaction(sig, optaction, oldaction = 0) /* Safe signals use "csighandler", which vectors through the PL_sighandlerp pointer when it's safe to do so. (BTW, "csighandler" is very different from "sighandler".) */ - svp = hv_fetch(action, "SAFE", 4, FALSE); + svp = hv_fetchs(action, "SAFE", FALSE); act.sa_handler = DPTR2FPTR( void (*)(), @@ -1366,7 +1366,7 @@ sigaction(sig, optaction, oldaction = 0) /* Vector new Perl handler through %SIG. (The core signal handlers read %SIG to dispatch.) */ - svp = hv_fetch(action, "HANDLER", 7, FALSE); + svp = hv_fetchs(action, "HANDLER", FALSE); if (!svp) croak("Can't supply an action without a HANDLER"); sv_setsv(*sigsvp, *svp); @@ -1389,7 +1389,7 @@ sigaction(sig, optaction, oldaction = 0) } /* Set up any desired mask. */ - svp = hv_fetch(action, "MASK", 4, FALSE); + svp = hv_fetchs(action, "MASK", FALSE); if (svp && sv_isa(*svp, "POSIX::SigSet")) { IV tmp = SvIV((SV*)SvRV(*svp)); sigset = INT2PTR(sigset_t*, tmp); @@ -1399,7 +1399,7 @@ sigaction(sig, optaction, oldaction = 0) sigemptyset(& act.sa_mask); /* Set up any desired flags. */ - svp = hv_fetch(action, "FLAGS", 5, FALSE); + svp = hv_fetchs(action, "FLAGS", FALSE); act.sa_flags = svp ? SvIV(*svp) : 0; /* Don't worry about cleaning up *sigsvp if this fails, diff --git a/gv.c b/gv.c index 7ebf280..e669daf 100644 --- a/gv.c +++ b/gv.c @@ -330,7 +330,7 @@ Perl_gv_fetchmeth(pTHX_ HV *stash, const char *name, STRLEN len, I32 level) return 0; /* cache indicates sub doesn't exist */ } - gvp = (GV**)hv_fetch(stash, "ISA", 3, FALSE); + gvp = (GV**)hv_fetchs(stash, "ISA", FALSE); av = (gvp && (gv = *gvp) && gv != (GV*)&PL_sv_undef) ? GvAV(gv) : NULL; /* create and re-create @.*::SUPER::ISA on demand */ @@ -342,9 +342,9 @@ Perl_gv_fetchmeth(pTHX_ HV *stash, const char *name, STRLEN len, I32 level) packlen -= 7; basestash = gv_stashpvn(hvname, packlen, TRUE); - gvp = (GV**)hv_fetch(basestash, "ISA", 3, FALSE); + gvp = (GV**)hv_fetchs(basestash, "ISA", FALSE); if (gvp && (gv = *gvp) != (GV*)&PL_sv_undef && (av = GvAV(gv))) { - gvp = (GV**)hv_fetch(stash, "ISA", 3, TRUE); + gvp = (GV**)hv_fetchs(stash, "ISA", TRUE); if (!gvp || !(gv = *gvp)) Perl_croak(aTHX_ "Cannot create %s::ISA", hvname); if (SvTYPE(gv) != SVt_PVGV) @@ -815,7 +815,7 @@ Perl_gv_fetchpvn_flags(pTHX_ const char *nambeg, STRLEN full_len, I32 flags, namend++; name = namend; if (!*name) - return gv ? gv : (GV*)*hv_fetch(PL_defstash, "main::", 6, TRUE); + return gv ? gv : (GV*)*hv_fetchs(PL_defstash, "main::", TRUE); } } len = namend - name; diff --git a/mg.c b/mg.c index 9ba8d10..fb47f1f 100644 --- a/mg.c +++ b/mg.c @@ -818,7 +818,7 @@ Perl_magic_get(pTHX_ SV *sv, MAGIC *mg) * it could have been extended by warnings::register */ SV **bits_all; HV * const bits=get_hv("warnings::Bits", FALSE); - if (bits && (bits_all=hv_fetch(bits, "all", 3, FALSE))) { + if (bits && (bits_all=hv_fetchs(bits, "all", FALSE))) { sv_setsv(sv, *bits_all); } else { diff --git a/pp_ctl.c b/pp_ctl.c index 193f0e2..8675561 100644 --- a/pp_ctl.c +++ b/pp_ctl.c @@ -1703,7 +1703,7 @@ PP(pp_caller) * it could have been extended by warnings::register */ SV **bits_all; HV * const bits = get_hv("warnings::Bits", FALSE); - if (bits && (bits_all=hv_fetch(bits, "all", 3, FALSE))) { + if (bits && (bits_all=hv_fetchs(bits, "all", FALSE))) { mask = newSVsv(*bits_all); } else { diff --git a/toke.c b/toke.c index dd5b71e..efa9e42 100644 --- a/toke.c +++ b/toke.c @@ -4208,7 +4208,7 @@ Perl_yylex(pTHX) else if (gv && !gvp && -tmp==KEY_lock /* XXX generalizable kludge */ && GvCVu(gv) - && !hv_fetch(GvHVn(PL_incgv), "Thread.pm", 9, FALSE)) + && !hv_fetchs(GvHVn(PL_incgv), "Thread.pm", FALSE)) { tmp = 0; /* any sub overrides "weak" keyword */ } @@ -10013,7 +10013,7 @@ S_scan_inputsymbol(pTHX_ char *start) if ((gv_readline && GvCVu(gv_readline) && GvIMPORTED_CV(gv_readline)) || - ((gvp = (GV**)hv_fetch(PL_globalstash, "readline", 8, FALSE)) + ((gvp = (GV**)hv_fetchs(PL_globalstash, "readline", FALSE)) && (gv_readline = *gvp) != (GV*)&PL_sv_undef && GvCVu(gv_readline) && GvIMPORTED_CV(gv_readline))) readline_overriden = TRUE; diff --git a/universal.c b/universal.c index 9e9b223..097247b 100644 --- a/universal.c +++ b/universal.c @@ -60,7 +60,7 @@ S_isa_lookup(pTHX_ HV *stash, const char *name, HV* name_stash, Perl_croak(aTHX_ "Recursive inheritance detected in package '%s'", hvname); - gvp = (GV**)hv_fetch(stash, "::ISA::CACHE::", 14, FALSE); + gvp = (GV**)hv_fetchs(stash, "::ISA::CACHE::", FALSE); if (gvp && (gv = *gvp) != (GV*)&PL_sv_undef && (subgen = GvSV(gv)) && (hv = GvHV(gv))) @@ -82,11 +82,11 @@ S_isa_lookup(pTHX_ HV *stash, const char *name, HV* name_stash, } } - gvp = (GV**)hv_fetch(stash,"ISA",3,FALSE); + gvp = (GV**)hv_fetchs(stash, "ISA", FALSE); if (gvp && (gv = *gvp) != (GV*)&PL_sv_undef && (av = GvAV(gv))) { if (!hv || !subgen) { - gvp = (GV**)hv_fetch(stash, "::ISA::CACHE::", 14, TRUE); + gvp = (GV**)hv_fetchs(stash, "::ISA::CACHE::", TRUE); gv = *gvp; @@ -342,7 +342,7 @@ XS(XS_UNIVERSAL_VERSION) pkg = gv_stashsv(ST(0), FALSE); } - gvp = pkg ? (GV**)hv_fetch(pkg,"VERSION",7,FALSE) : Null(GV**); + gvp = pkg ? (GV**)hv_fetchs(pkg, "VERSION", FALSE) : Null(GV**); if (gvp && isGV(gv = *gvp) && (sv = GvSV(gv)) && SvOK(sv)) { SV * const nsv = sv_newmortal(); diff --git a/utf8.c b/utf8.c index 7dc5d99..c80802a 100644 --- a/utf8.c +++ b/utf8.c @@ -1784,11 +1784,11 @@ S_swash_get(pTHX_ SV* swash, UV start, UV span) STRLEN lcur, xcur, scur; HV* const hv = (HV*)SvRV(swash); - SV** const listsvp = hv_fetch(hv, "LIST", 4, FALSE); - SV** const typesvp = hv_fetch(hv, "TYPE", 4, FALSE); - SV** const bitssvp = hv_fetch(hv, "BITS", 4, FALSE); - SV** const nonesvp = hv_fetch(hv, "NONE", 4, FALSE); - SV** const extssvp = hv_fetch(hv, "EXTRAS", 6, FALSE); + SV** const listsvp = hv_fetchs(hv, "LIST", FALSE); + SV** const typesvp = hv_fetchs(hv, "TYPE", FALSE); + SV** const bitssvp = hv_fetchs(hv, "BITS", FALSE); + SV** const nonesvp = hv_fetchs(hv, "NONE", FALSE); + SV** const extssvp = hv_fetchs(hv, "EXTRAS", FALSE); const U8* const typestr = (U8*)SvPV_nolen(*typesvp); const int typeto = typestr[0] == 'T' && typestr[1] == 'o'; const STRLEN bits = SvUV(*bitssvp); @@ -1991,7 +1991,7 @@ S_swash_get(pTHX_ SV* swash, UV start, UV span) othersvp = hv_fetch(hv, (char *)namestr, namelen, FALSE); otherhv = (HV*)SvRV(*othersvp); - otherbitssvp = hv_fetch(otherhv, "BITS", 4, FALSE); + otherbitssvp = hv_fetchs(otherhv, "BITS", FALSE); otherbits = (STRLEN)SvUV(*otherbitssvp); if (bits < otherbits) Perl_croak(aTHX_ "panic: swash_get found swatch size mismatch"); diff --git a/util.c b/util.c index 5560fc8..9895f26 100644 --- a/util.c +++ b/util.c @@ -4154,11 +4154,11 @@ Perl_new_version(pTHX_ SV *ver) if ( hv_exists((HV*)ver, "width", 5 ) ) { - const I32 width = SvIV(*hv_fetch((HV*)ver, "width", 5, FALSE)); + const I32 width = SvIV(*hv_fetchs((HV*)ver, "width", FALSE)); hv_store((HV *)hv, "width", 5, newSViv(width), 0); } - sav = (AV *)SvRV(*hv_fetch((HV*)ver, "version", 7, FALSE)); + sav = (AV *)SvRV(*hv_fetchs((HV*)ver, "version", FALSE)); /* This will get reblessed later if a derived class*/ for ( key = 0; key <= av_len(sav); key++ ) { @@ -4265,7 +4265,7 @@ Perl_vverify(pTHX_ SV *vs) /* see if the appropriate elements exist */ if ( SvTYPE(vs) == SVt_PVHV && hv_exists((HV*)vs, "version", 7) - && (sv = SvRV(*hv_fetch((HV*)vs, "version", 7, FALSE))) + && (sv = SvRV(*hv_fetchs((HV*)vs, "version", FALSE))) && SvTYPE(sv) == SVt_PVAV ) return TRUE; else @@ -4304,13 +4304,13 @@ Perl_vnumify(pTHX_ SV *vs) if ( hv_exists((HV*)vs, "alpha", 5 ) ) alpha = TRUE; if ( hv_exists((HV*)vs, "width", 5 ) ) - width = SvIV(*hv_fetch((HV*)vs, "width", 5, FALSE)); + width = SvIV(*hv_fetchs((HV*)vs, "width", FALSE)); else width = 3; /* attempt to retrieve the version array */ - if ( !(av = (AV *)SvRV(*hv_fetch((HV*)vs, "version", 7, FALSE)) ) ) { + if ( !(av = (AV *)SvRV(*hv_fetchs((HV*)vs, "version", FALSE)) ) ) { sv_catpvs(sv,"0"); return sv; } @@ -4380,7 +4380,7 @@ Perl_vnormal(pTHX_ SV *vs) if ( hv_exists((HV*)vs, "alpha", 5 ) ) alpha = TRUE; - av = (AV *)SvRV(*hv_fetch((HV*)vs, "version", 7, FALSE)); + av = (AV *)SvRV(*hv_fetchs((HV*)vs, "version", FALSE)); len = av_len(av); if ( len == -1 ) @@ -4468,12 +4468,12 @@ Perl_vcmp(pTHX_ SV *lhv, SV *rhv) Perl_croak(aTHX_ "Invalid version object"); /* get the left hand term */ - lav = (AV *)SvRV(*hv_fetch((HV*)lhv, "version", 7, FALSE)); + lav = (AV *)SvRV(*hv_fetchs((HV*)lhv, "version", FALSE)); if ( hv_exists((HV*)lhv, "alpha", 5 ) ) lalpha = TRUE; /* and the right hand term */ - rav = (AV *)SvRV(*hv_fetch((HV*)rhv, "version", 7, FALSE)); + rav = (AV *)SvRV(*hv_fetchs((HV*)rhv, "version", FALSE)); if ( hv_exists((HV*)rhv, "alpha", 5 ) ) ralpha = TRUE;