Skip to content

Commit c812819

Browse files
committed
Use -s macros with literals to avoid magic numbers
Note hv_stores also drops the trailing hash param from its hv_store counterpart as the hash is computed automatically at compile time.
1 parent 43efca4 commit c812819

File tree

1 file changed

+54
-54
lines changed

1 file changed

+54
-54
lines changed

DBI.xs

Lines changed: 54 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ typedef struct dbi_ima_st {
199199
(SvOK(state) /* SQLSTATE is implemented by driver */ \
200200
? (strEQ(SvPV_nolen(state),"00000") ? &PL_sv_no : sv_mortalcopy(state))\
201201
: (SvTRUE(DBIc_ERR(imp_xxh)) \
202-
? sv_2mortal(newSVpv("S1000",5)) /* General error */ \
202+
? sv_2mortal(newSVpvs("S1000")) /* General error */ \
203203
: &PL_sv_no) /* Success ("00000") */ \
204204
)
205205

@@ -424,7 +424,7 @@ _join_hash_sorted(HV *hash, char *kv_sep, STRLEN kv_sep_len, char *pair_sep, STR
424424

425425
keys = _sort_hash_keys(hash, num_sort, &total_len);
426426
if (!keys)
427-
return newSVpv("", 0);
427+
return newSVpvs("");
428428

429429
if (!kv_sep_len)
430430
kv_sep_len = strlen(kv_sep);
@@ -445,7 +445,7 @@ _join_hash_sorted(HV *hash, char *kv_sep, STRLEN kv_sep_len, char *pair_sep, STR
445445

446446
if (!hash_svp) { /* should never happen */
447447
warn("No hash entry with key '%s'", keys[i]);
448-
sv_catpvn(return_sv, "???", 3);
448+
sv_catpvs(return_sv, "???");
449449
continue;
450450
}
451451

@@ -456,11 +456,11 @@ _join_hash_sorted(HV *hash, char *kv_sep, STRLEN kv_sep_len, char *pair_sep, STR
456456
if (SvOK(*hash_svp)) {
457457
STRLEN hv_val_len;
458458
char *hv_val = SvPV(*hash_svp, hv_val_len);
459-
sv_catpvn(return_sv, "'", 1);
459+
sv_catpvs(return_sv, "'");
460460
sv_catpvn(return_sv, hv_val, hv_val_len);
461-
sv_catpvn(return_sv, "'", 1);
461+
sv_catpvs(return_sv, "'");
462462
}
463-
else sv_catpvn(return_sv, "undef", 5);
463+
else sv_catpvs(return_sv, "undef");
464464
}
465465

466466
if (i < hv_len-1)
@@ -611,14 +611,14 @@ neatsvpv(SV *sv, STRLEN maxlen) /* return a tidy ascii value, for debugging only
611611
if (SvMAGICAL(sv)) {
612612
if (DBIS_TRACE_LEVEL >= 5) { /* add magic details to help debugging */
613613
MAGIC* mg;
614-
infosv = sv_2mortal(newSVpv(" (magic-",0));
615-
if (SvSMAGICAL(sv)) sv_catpvn(infosv,"s",1);
616-
if (SvGMAGICAL(sv)) sv_catpvn(infosv,"g",1);
617-
if (SvRMAGICAL(sv)) sv_catpvn(infosv,"r",1);
618-
sv_catpvn(infosv,":",1);
614+
infosv = sv_2mortal(newSVpvs(" (magic-"));
615+
if (SvSMAGICAL(sv)) sv_catpvs(infosv, "s");
616+
if (SvGMAGICAL(sv)) sv_catpvs(infosv, "g");
617+
if (SvRMAGICAL(sv)) sv_catpvs(infosv, "r");
618+
sv_catpvs(infosv, ":");
619619
for (mg = SvMAGIC(sv); mg; mg = mg->mg_moremagic)
620620
sv_catpvn(infosv, &mg->mg_type, 1);
621-
sv_catpvn(infosv, ")", 1);
621+
sv_catpvs(infosv, ")");
622622
}
623623
if (SvGMAGICAL(sv) && !PL_dirty)
624624
mg_get(sv); /* trigger magic to FETCH the value */
@@ -688,7 +688,7 @@ neatsvpv(SV *sv, STRLEN maxlen) /* return a tidy ascii value, for debugging only
688688
SvGROW(nsv, (1+maxlen+1+1));
689689
sv_setpvn(nsv, quote, 1);
690690
sv_catpvn(nsv, v, maxlen-3); /* account for three dots */
691-
sv_catpvn(nsv, "...", 3);
691+
sv_catpvs(nsv, "...");
692692
} else {
693693
SvGROW(nsv, (1+len+1+1));
694694
sv_setpvn(nsv, quote, 1);
@@ -717,9 +717,9 @@ copy_statement_to_parent(pTHX_ SV *h, imp_xxh_t *imp_xxh)
717717
return;
718718
parent = DBIc_PARENT_H(imp_xxh);
719719
if (parent && SvROK(parent)) {
720-
SV *tmp_sv = *hv_fetch((HV*)SvRV(h), "Statement", 9, 1);
720+
SV *tmp_sv = *hv_fetchs((HV*)SvRV(h), "Statement", 1);
721721
if (SvOK(tmp_sv))
722-
(void)hv_store((HV*)SvRV(parent), "Statement", 9, SvREFCNT_inc(tmp_sv), 0);
722+
(void)hv_stores((HV*)SvRV(parent), "Statement", SvREFCNT_inc(tmp_sv));
723723
}
724724
}
725725

@@ -753,7 +753,7 @@ set_err_sv(SV *h, imp_xxh_t *imp_xxh, SV *err, SV *errstr, SV *state, SV *method
753753
int err_changed = 0;
754754

755755
if ( DBIc_has(imp_xxh, DBIcf_HandleSetErr)
756-
&& (hook_svp = hv_fetch((HV*)SvRV(h),"HandleSetErr",12,0))
756+
&& (hook_svp = hv_fetchs((HV*)SvRV(h), "HandleSetErr", 0))
757757
&& hook_svp
758758
&& ((void)(SvGMAGICAL(*hook_svp) && mg_get(*hook_svp)), SvOK(*hook_svp))
759759
) {
@@ -812,7 +812,7 @@ set_err_sv(SV *h, imp_xxh_t *imp_xxh, SV *err, SV *errstr, SV *state, SV *method
812812
if (SvTRUE(h_state) && SvTRUE(state) && strNE(SvPV_nolen(h_state), SvPV_nolen(state)))
813813
sv_catpvf(h_errstr, " [state was %s now %s]", SvPV_nolen(h_state), SvPV_nolen(state));
814814
if (strNE(SvPV_nolen(h_errstr), SvPV_nolen(errstr))) {
815-
sv_catpvn(h_errstr, "\n", 1);
815+
sv_catpvs(h_errstr, "\n");
816816
sv_catsv(h_errstr, errstr);
817817
}
818818
}
@@ -1106,7 +1106,7 @@ dbih_inner(pTHX_ SV *orv, const char *what)
11061106
if (!SvMAGICAL(ohv)) {
11071107
if (!what)
11081108
return NULL;
1109-
if (!hv_fetch(ohv,"_NO_DESTRUCT_WARN",17,0))
1109+
if (!hv_fetchs(ohv, "_NO_DESTRUCT_WARN", 0))
11101110
sv_dump(orv);
11111111
croak("%s handle %s is not a DBI handle (has no magic)",
11121112
what, neatsvpv(orv,0));
@@ -1436,7 +1436,7 @@ dbih_setup_handle(pTHX_ SV *orv, char *imp_class, SV *parent, SV *imp_datasv)
14361436
if ( (imp_mem_stash = gv_stashsv(imp_mem_name, FALSE)) == NULL)
14371437
croak(errmsg, neatsvpv(orv,0), SvPVbyte_nolen(imp_mem_name), "unknown _mem package");
14381438

1439-
if ((svp = hv_fetch((HV*)SvRV(h), "dbi_imp_data", 12, 0))) {
1439+
if ((svp = hv_fetchs((HV*)SvRV(h), "dbi_imp_data", 0))) {
14401440
dbi_imp_data = *svp;
14411441
if (SvGMAGICAL(dbi_imp_data)) /* call FETCH via magic */
14421442
mg_get(dbi_imp_data);
@@ -1477,13 +1477,13 @@ dbih_setup_handle(pTHX_ SV *orv, char *imp_class, SV *parent, SV *imp_datasv)
14771477

14781478
/* setup Callbacks from parents' ChildCallbacks */
14791479
if (DBIc_has(parent_imp, DBIcf_Callbacks)
1480-
&& (tmp_svp = hv_fetch((HV*)SvRV(parent), "Callbacks", 9, 0))
1480+
&& (tmp_svp = hv_fetchs((HV*)SvRV(parent), "Callbacks", 0))
14811481
&& SvROK(*tmp_svp) && SvTYPE(SvRV(*tmp_svp)) == SVt_PVHV
1482-
&& (tmp_svp = hv_fetch((HV*)SvRV(*tmp_svp), "ChildCallbacks", 14, 0))
1482+
&& (tmp_svp = hv_fetchs((HV*)SvRV(*tmp_svp), "ChildCallbacks", 0))
14831483
&& SvROK(*tmp_svp) && SvTYPE(SvRV(*tmp_svp)) == SVt_PVHV
14841484
) {
14851485
/* XXX mirrors behaviour of dbih_set_attr_k() of Callbacks */
1486-
(void)hv_store((HV*)SvRV(h), "Callbacks", 9, newRV_inc(SvRV(*tmp_svp)), 0);
1486+
(void)hv_stores((HV*)SvRV(h), "Callbacks", newRV_inc(SvRV(*tmp_svp)));
14871487
DBIc_set(imp, DBIcf_Callbacks, 1);
14881488
}
14891489

@@ -1492,7 +1492,7 @@ dbih_setup_handle(pTHX_ SV *orv, char *imp_class, SV *parent, SV *imp_datasv)
14921492
if (1) {
14931493
AV *av;
14941494
/* add weakref to new (outer) handle into parents ChildHandles array */
1495-
tmp_svp = hv_fetch((HV*)SvRV(parent), "ChildHandles", 12, 1);
1495+
tmp_svp = hv_fetchs((HV*)SvRV(parent), "ChildHandles", 1);
14961496
if (!SvROK(*tmp_svp)) {
14971497
SV *ChildHandles_rvav = newRV_noinc((SV*)newAV());
14981498
sv_setsv(*tmp_svp, ChildHandles_rvav);
@@ -1521,16 +1521,16 @@ dbih_setup_handle(pTHX_ SV *orv, char *imp_class, SV *parent, SV *imp_datasv)
15211521
switch (DBIc_TYPE(imp)) {
15221522
case DBIt_DB:
15231523
/* cache _inner_ handle, but also see quick_FETCH */
1524-
(void)hv_store((HV*)SvRV(h), "Driver", 6, newRV_inc(SvRV(parent)), 0);
1525-
(void)hv_fetch((HV*)SvRV(h), "Statement", 9, 1); /* store writable undef */
1524+
(void)hv_stores((HV*)SvRV(h), "Driver", newRV_inc(SvRV(parent)));
1525+
(void)hv_fetchs((HV*)SvRV(h), "Statement", 1); /* store writable undef */
15261526
break;
15271527
case DBIt_ST:
15281528
DBIc_NUM_FIELDS((imp_sth_t*)imp) = -1;
15291529
/* cache _inner_ handle, but also see quick_FETCH */
1530-
(void)hv_store((HV*)SvRV(h), "Database", 8, newRV_inc(SvRV(parent)), 0);
1530+
(void)hv_stores((HV*)SvRV(h), "Database", newRV_inc(SvRV(parent)));
15311531
/* copy (alias) Statement from the sth up into the dbh */
1532-
tmp_svp = hv_fetch((HV*)SvRV(h), "Statement", 9, 1);
1533-
(void)hv_store((HV*)SvRV(parent), "Statement", 9, SvREFCNT_inc(*tmp_svp), 0);
1532+
tmp_svp = hv_fetchs((HV*)SvRV(h), "Statement", 1);
1533+
(void)hv_stores((HV*)SvRV(parent), "Statement", SvREFCNT_inc(*tmp_svp));
15341534
break;
15351535
}
15361536
}
@@ -1585,7 +1585,7 @@ static int
15851585
dbih_dumpcom(pTHX_ imp_xxh_t *imp_xxh, const char *msg, int level)
15861586
{
15871587
dMY_CXT;
1588-
SV *flags = sv_2mortal(newSVpv("",0));
1588+
SV *flags = sv_2mortal(newSVpvs(""));
15891589
SV *inner;
15901590
static const char pad[] = " ";
15911591
if (!msg)
@@ -1637,7 +1637,7 @@ dbih_dumpcom(pTHX_ imp_xxh_t *imp_xxh, const char *msg, int level)
16371637
if (!inner || !SvROK(inner))
16381638
return 1;
16391639
if (DBIc_TYPE(imp_xxh) <= DBIt_DB) {
1640-
SV **svp = hv_fetch((HV*)SvRV(inner), "CachedKids", 10, 0);
1640+
SV **svp = hv_fetchs((HV*)SvRV(inner), "CachedKids", 0);
16411641
if (svp && SvROK(*svp) && SvTYPE(SvRV(*svp)) == SVt_PVHV) {
16421642
HV *hv = (HV*)SvRV(*svp);
16431643
PerlIO_printf(DBILOGFP,"%s CachedKids %d\n", pad, (int)HvKEYS(hv));
@@ -1653,12 +1653,12 @@ dbih_dumpcom(pTHX_ imp_xxh_t *imp_xxh, const char *msg, int level)
16531653
}
16541654
}
16551655
else if (DBIc_TYPE(imp_xxh) == DBIt_DB) {
1656-
SV **svp = hv_fetch((HV*)SvRV(inner), "Name", 4, 0);
1656+
SV **svp = hv_fetchs((HV*)SvRV(inner), "Name", 0);
16571657
if (svp && SvOK(*svp))
16581658
PerlIO_printf(DBILOGFP,"%s Name %s\n", pad, neatsvpv(*svp,0));
16591659
}
16601660
else if (DBIc_TYPE(imp_xxh) == DBIt_ST) {
1661-
SV **svp = hv_fetch((HV*)SvRV(inner), "Statement", 9, 0);
1661+
SV **svp = hv_fetchs((HV*)SvRV(inner), "Statement", 0);
16621662
if (svp && SvOK(*svp))
16631663
PerlIO_printf(DBILOGFP,"%s Statement %s\n", pad, neatsvpv(*svp,0));
16641664
}
@@ -1833,7 +1833,7 @@ dbih_get_fbav(imp_sth_t *imp_sth)
18331833
"0", 0, "Number of row fields inconsistent with NUM_OF_FIELDS (driver bug)", "", "_get_fbav");
18341834
/*
18351835
DBIc_NUM_FIELDS(imp_sth) = i;
1836-
hv_delete((HV*)SvRV(sth), "NUM_OF_FIELDS", 13, G_DISCARD);
1836+
hv_deletes((HV*)SvRV(sth), "NUM_OF_FIELDS", G_DISCARD);
18371837
*/
18381838
}
18391839
/* don't let SvUTF8 flag persist from one row to the next */
@@ -2351,7 +2351,7 @@ dbih_get_attr_k(SV *h, SV *keysv, int dbikey)
23512351
valuesv = &PL_sv_undef;
23522352

23532353
/* fetch from tied outer handle to trigger FETCH magic */
2354-
svp = hv_fetch((HV*)DBIc_MY_H(imp_sth), "NAME",4, FALSE);
2354+
svp = hv_fetchs((HV*)DBIc_MY_H(imp_sth), "NAME", FALSE);
23552355
sv = (svp) ? *svp : &PL_sv_undef;
23562356
if (SvGMAGICAL(sv)) /* call FETCH via magic */
23572357
mg_get(sv);
@@ -2751,14 +2751,14 @@ log_where(SV *buf, int append, char *prefix, char *suffix, int show_line, int sh
27512751
dTHX;
27522752
dTHR;
27532753
if (!buf)
2754-
buf = sv_2mortal(newSVpv("",0));
2754+
buf = sv_2mortal(newSVpvs(""));
27552755
else if (!append)
27562756
sv_setpv(buf,"");
27572757
if (CopLINE(PL_curcop)) {
27582758
COP *cop;
27592759
dbi_caller_string(buf, PL_curcop, prefix, show_line, show_path);
27602760
if (show_caller && (cop = dbi_caller_cop())) {
2761-
SV *via = sv_2mortal(newSVpv("",0));
2761+
SV *via = sv_2mortal(newSVpvs(""));
27622762
dbi_caller_string(via, cop, prefix, show_line, show_path);
27632763
sv_catpvf(buf, " via %s", SvPV_nolen(via));
27642764
}
@@ -2775,7 +2775,7 @@ static void
27752775
clear_cached_kids(pTHX_ SV *h, imp_xxh_t *imp_xxh, const char *meth_name, int trace_level)
27762776
{
27772777
if (DBIc_TYPE(imp_xxh) <= DBIt_DB) {
2778-
SV **svp = hv_fetch((HV*)SvRV(h), "CachedKids", 10, 0);
2778+
SV **svp = hv_fetchs((HV*)SvRV(h), "CachedKids", 0);
27792779
if (svp && SvROK(*svp) && SvTYPE(SvRV(*svp)) == SVt_PVHV) {
27802780
HV *hv = (HV*)SvRV(*svp);
27812781
if (HvKEYS(hv)) {
@@ -2889,7 +2889,7 @@ dbi_profile(SV *h, imp_xxh_t *imp_xxh, SV *statement_sv, SV *method, NV t1, NV t
28892889

28902890
h_hv = (HV*)SvRV(dbih_inner(aTHX_ h, "dbi_profile"));
28912891

2892-
profile = *hv_fetch(h_hv, "Profile", 7, 1);
2892+
profile = *hv_fetchs(h_hv, "Profile", 1);
28932893
if (profile && SvMAGICAL(profile))
28942894
mg_get(profile); /* FETCH */
28952895
if (!profile || !SvROK(profile)) {
@@ -2906,7 +2906,7 @@ dbi_profile(SV *h, imp_xxh_t *imp_xxh, SV *statement_sv, SV *method, NV t1, NV t
29062906
/* statement_sv: undef = use $h->{Statement}, "" (&sv_no) = use empty string */
29072907

29082908
if (!SvOK(statement_sv)) {
2909-
SV **psv = hv_fetch(h_hv, "Statement", 9, 0);
2909+
SV **psv = hv_fetchs(h_hv, "Statement", 0);
29102910
statement_sv = (psv && SvOK(*psv)) ? *psv : &PL_sv_no;
29112911
}
29122912
statement_pv = SvPV_nolen(statement_sv);
@@ -2917,7 +2917,7 @@ dbi_profile(SV *h, imp_xxh_t *imp_xxh, SV *statement_sv, SV *method, NV t1, NV t
29172917

29182918
dest_node = _profile_next_node(profile, "Data");
29192919

2920-
tmp = *hv_fetch((HV*)SvRV(profile), "Path", 4, 1);
2920+
tmp = *hv_fetchs((HV*)SvRV(profile), "Path", 1);
29212921
if (SvROK(tmp) && SvTYPE(SvRV(tmp))==SVt_PVAV) {
29222922
int len;
29232923
av = (AV*)SvRV(tmp);
@@ -2982,7 +2982,7 @@ dbi_profile(SV *h, imp_xxh_t *imp_xxh, SV *statement_sv, SV *method, NV t1, NV t
29822982
else if (isGV(method)) {
29832983
/* just using SvPV_nolen(method) sometimes causes an error: */
29842984
/* "Can't coerce GLOB to string" so we use gv_efullname() */
2985-
SV *tmpsv = sv_2mortal(newSVpv("",0));
2985+
SV *tmpsv = sv_2mortal(newSVpvs(""));
29862986
gv_efullname4(tmpsv, (GV*)method, "", TRUE);
29872987
p = SvPV_nolen(tmpsv);
29882988
if (*p == '*') ++p; /* skip past leading '*' glob sigil */
@@ -3414,7 +3414,7 @@ XS(XS_DBI_dispatch)
34143414
keep_error = TRUE;
34153415
if (ima_flags & IMA_CLEAR_STMT) {
34163416
/* don't use SvOK_off: dbh's Statement may be ref to sth's */
3417-
(void)hv_store((HV*)SvRV(h), "Statement", 9, &PL_sv_undef, 0);
3417+
(void)hv_stores((HV*)SvRV(h), "Statement", &PL_sv_undef);
34183418
}
34193419
if (ima_flags & IMA_CLEAR_CACHED_KIDS)
34203420
clear_cached_kids(aTHX_ h, imp_xxh, meth_name, trace_flags);
@@ -3463,7 +3463,7 @@ XS(XS_DBI_dispatch)
34633463
if (is_DESTROY) {
34643464

34653465
/* force destruction of any outstanding children */
3466-
if ((tmp_svp = hv_fetch((HV*)SvRV(h), "ChildHandles", 12, FALSE)) && SvROK(*tmp_svp)) {
3466+
if ((tmp_svp = hv_fetchs((HV*)SvRV(h), "ChildHandles", FALSE)) && SvROK(*tmp_svp)) {
34673467
AV *av = (AV*)SvRV(*tmp_svp);
34683468
I32 kidslots;
34693469
PerlIO *logfp = DBILOGFP;
@@ -3555,7 +3555,7 @@ XS(XS_DBI_dispatch)
35553555
}
35563556

35573557
if (DBIc_has(imp_xxh,DBIcf_Callbacks)
3558-
&& (tmp_svp = hv_fetch((HV*)SvRV(h), "Callbacks", 9, 0))
3558+
&& (tmp_svp = hv_fetchs((HV*)SvRV(h), "Callbacks", 0))
35593559
&& ( (hook_svp = hv_fetch((HV*)SvRV(*tmp_svp), meth_name, strlen(meth_name), 0))
35603560
/* the "*" fallback callback only applies to non-nested calls
35613561
* and also doesn't apply to the 'set_err' or DESTROY methods.
@@ -3565,7 +3565,7 @@ XS(XS_DBI_dispatch)
35653565
*/
35663566
|| (!is_nested_call && !PL_dirty && meth_type != methtype_set_err &&
35673567
meth_type != methtype_DESTROY &&
3568-
(hook_svp = hv_fetch((HV*)SvRV(*tmp_svp), "*", 1, 0))
3568+
(hook_svp = hv_fetchs((HV*)SvRV(*tmp_svp), "*", 0))
35693569
)
35703570
)
35713571
&& SvROK(*hook_svp)
@@ -3924,7 +3924,7 @@ XS(XS_DBI_dispatch)
39243924
/* and may mess up the error handling below for the commit/rollback */
39253925
PUSHMARK(SP);
39263926
XPUSHs(h);
3927-
mXPUSHs(newSVpv("AutoCommit", 0));
3927+
mXPUSHs(newSVpvs("AutoCommit"));
39283928
XPUSHs(&PL_sv_yes);
39293929
PUTBACK;
39303930
call_method("STORE", G_VOID);
@@ -4002,7 +4002,7 @@ XS(XS_DBI_dispatch)
40024002
char intro[200];
40034003

40044004
if (meth_type == methtype_set_err) {
4005-
SV **sem_svp = hv_fetch((HV*)SvRV(h), "dbi_set_err_method", 18, GV_ADDWARN);
4005+
SV **sem_svp = hv_fetchs((HV*)SvRV(h), "dbi_set_err_method", GV_ADDWARN);
40064006
if (SvOK(*sem_svp))
40074007
err_meth_name = SvPV_nolen(*sem_svp);
40084008
}
@@ -4020,7 +4020,7 @@ XS(XS_DBI_dispatch)
40204020
if ( DBIc_has(imp_xxh, DBIcf_ShowErrorStatement)
40214021
&& !is_unrelated_to_Statement
40224022
&& (DBIc_TYPE(imp_xxh) == DBIt_ST || ima_flags & IMA_SHOW_ERR_STMT)
4023-
&& (statement_svp = hv_fetch((HV*)SvRV(h), "Statement", 9, 0))
4023+
&& (statement_svp = hv_fetchs((HV*)SvRV(h), "Statement", 0))
40244024
&& statement_svp && SvOK(*statement_svp)
40254025
) {
40264026
SV **svp = 0;
@@ -4030,7 +4030,7 @@ XS(XS_DBI_dispatch)
40304030
/* fetch from tied outer handle to trigger FETCH magic */
40314031
/* could add DBIcf_ShowErrorParams (default to on?) */
40324032
if (!(ima_flags & IMA_HIDE_ERR_PARAMVALUES)) {
4033-
svp = hv_fetch((HV*)DBIc_MY_H(imp_xxh),"ParamValues",11,FALSE);
4033+
svp = hv_fetchs((HV*)DBIc_MY_H(imp_xxh), "ParamValues", FALSE);
40344034
if (svp && SvMAGICAL(*svp))
40354035
mg_get(*svp); /* XXX may recurse, may croak. could use eval */
40364036
}
@@ -4055,7 +4055,7 @@ XS(XS_DBI_dispatch)
40554055
hook_svp = NULL;
40564056
if ( (SvTRUE(err_sv) || (is_warning && DBIc_has(imp_xxh, DBIcf_RaiseWarn)))
40574057
&& DBIc_has(imp_xxh, DBIcf_HandleError)
4058-
&& (hook_svp = hv_fetch((HV*)SvRV(h),"HandleError",11,0))
4058+
&& (hook_svp = hv_fetchs((HV*)SvRV(h), "HandleError", 0))
40594059
&& hook_svp && SvOK(*hook_svp)
40604060
) {
40614061
dSP;
@@ -4604,7 +4604,7 @@ _new_handle(class, parent, attr_ref, imp_datasv, imp_class)
46044604
PERL_UNUSED_VAR(cv);
46054605
}
46064606

4607-
(void)hv_store((HV*)SvRV(attr_ref), "ImplementorClass", 16, SvREFCNT_inc(imp_class), 0);
4607+
(void)hv_stores((HV*)SvRV(attr_ref), "ImplementorClass", SvREFCNT_inc(imp_class));
46084608

46094609
/* make attr into inner handle by blessing it into class */
46104610
sv_bless(attr_ref, class_stash);
@@ -4710,7 +4710,7 @@ _install_method(dbi_class, meth_name, file, attribs=Nullsv)
47104710
{
47114711
dMY_CXT;
47124712
/* install another method name/interface for the DBI dispatcher */
4713-
SV *trace_msg = (DBIS_TRACE_LEVEL >= 10) ? sv_2mortal(newSVpv("",0)) : Nullsv;
4713+
SV *trace_msg = (DBIS_TRACE_LEVEL >= 10) ? sv_2mortal(newSVpvs("")) : Nullsv;
47144714
CV *cv;
47154715
SV **svp;
47164716
dbi_ima_t *ima;
@@ -5125,7 +5125,7 @@ take_imp_data(h)
51255125
* destroyed they may need to interact with the 'zombie' parent dbh.
51265126
* So we do our best to neautralize them (finish & rebless)
51275127
*/
5128-
if ((tmp_svp = hv_fetch((HV*)SvRV(h), "ChildHandles", 12, FALSE)) && SvROK(*tmp_svp)) {
5128+
if ((tmp_svp = hv_fetchs((HV*)SvRV(h), "ChildHandles", FALSE)) && SvROK(*tmp_svp)) {
51295129
AV *av = (AV*)SvRV(*tmp_svp);
51305130
HV *zombie_stash = gv_stashpv("DBI::zombie", GV_ADDWARN);
51315131
I32 kidslots;
@@ -5569,7 +5569,7 @@ set_err(h, err, errstr=&PL_sv_no, state=&PL_sv_undef, method=&PL_sv_undef, resul
55695569
}
55705570
else {
55715571
/* store provided method name so handler code can find it */
5572-
sem_svp = hv_fetch((HV*)SvRV(h), "dbi_set_err_method", 18, 1);
5572+
sem_svp = hv_fetchs((HV*)SvRV(h), "dbi_set_err_method", 1);
55735573
if (SvOK(method)) {
55745574
sv_setpv(*sem_svp, SvPV_nolen(method));
55755575
}

0 commit comments

Comments
 (0)