From: Vincent Pit Date: Thu, 12 Feb 2009 20:48:29 +0000 (+0100) Subject: croak() if storing the wizard in the context fails, but don't let that mess up the... X-Git-Tag: v0.31~13 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=8c47f583e6aedb31d225a6941d2f12eb8ee4810b;p=perl%2Fmodules%2FVariable-Magic.git croak() if storing the wizard in the context fails, but don't let that mess up the coverage --- diff --git a/Magic.xs b/Magic.xs index 05c707e..7089937 100644 --- a/Magic.xs +++ b/Magic.xs @@ -905,6 +905,7 @@ STATIC const char vmg_invalid_sig[] = "Invalid numeric signature"; STATIC const char vmg_wrongargnum[] = "Wrong number of arguments"; STATIC const char vmg_toomanysigs[] = "Too many magic signatures used"; STATIC const char vmg_argstorefailed[] = "Error while storing arguments"; +STATIC const char vmg_globstorefail[] = "Couldn't store global wizard information"; STATIC U16 vmg_sv2sig(pTHX_ SV *sv) { #define vmg_sv2sig(S) vmg_sv2sig(aTHX_ (S)) @@ -1094,7 +1095,7 @@ CODE: mg = sv_magicext(sv, NULL, PERL_MAGIC_ext, &vmg_wizard_vtbl, NULL, 0); mg->mg_private = SIG_WIZ; SvREADONLY_on(sv); - hv_store(hv, sig, len, sv, HeHASH(key)); + if (!hv_store(hv, sig, len, sv, HeHASH(key))) croak("%s during CLONE", vmg_globstorefail); } } { @@ -1194,7 +1195,7 @@ CODE: mg->mg_private = SIG_WIZ; SvREADONLY_on(sv); - hv_store(MY_CXT, buf, sprintf(buf, "%u", sig), sv, 0); + if (!hv_store(MY_CXT, buf, sprintf(buf, "%u", sig), sv, 0)) croak(vmg_globstorefail); RETVAL = newRV_noinc(sv); OUTPUT: