From: Jesse Luehrs Date: Sat, 13 Nov 2010 17:59:10 +0000 (-0600) Subject: error checking on hv_store X-Git-Tag: 0.14~30 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e8d57afddfc331861bd33304ea4cd54d36d1b95e;p=gitmo%2FPackage-Stash-XS.git error checking on hv_store --- diff --git a/Stash.xs b/Stash.xs index 78b395f..2fc0613 100644 --- a/Stash.xs +++ b/Stash.xs @@ -277,9 +277,11 @@ new(class, package_name) instance = newHV(); - hv_store(instance, "name", 4, SvREFCNT_inc_simple_NN(package_name), 0); + if (!hv_store(instance, "name", 4, SvREFCNT_inc_simple_NN(package_name), 0)) + croak("Couldn't initialize the 'name' key, hv_store failed"); namespace = gv_stashpv(SvPV_nolen(package_name), GV_ADD); - hv_store(instance, "namespace", 9, newRV_inc((SV*)namespace), 0); + if (!hv_store(instance, "namespace", 9, newRV_inc((SV*)namespace), 0)) + croak("Couldn't initialize the 'namespace' key, hv_store failed"); RETVAL = sv_bless(newRV_noinc((SV*)instance), gv_stashpv(class, 0)); OUTPUT: