From: oetiker Date: Tue, 31 Jul 2012 12:43:45 +0000 (+0000) Subject: RRDs.xs uses &PL_sv_undef to insert undefined values into arrays and hashes. This... X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=38d036ed6cd2a947aeb392dbb7bdf8fe6064a88b;p=rrdtool-all.git RRDs.xs uses &PL_sv_undef to insert undefined values into arrays and hashes. This leads to all sorts of problems. For details, please see "AVs, HVs and undefined values" section in perlguts(1). -- patch by tobez+lars git-svn-id: svn://svn.oetiker.ch/rrdtool/branches/1.4@2296 a5681a0c-68f1-0310-ab6d-d61299d08faa --- diff --git a/program/bindings/perl-shared/RRDs.xs b/program/bindings/perl-shared/RRDs.xs index 252018f5..830a779d 100644 --- a/program/bindings/perl-shared/RRDs.xs +++ b/program/bindings/perl-shared/RRDs.xs @@ -81,7 +81,7 @@ extern "C" { switch (data->type) { \ case RD_I_VAL: \ if (isnan(data->value.u_val)) \ - hvs(&PL_sv_undef); \ + hvs(newSV(0)); \ else \ hvs(newSVnv(data->value.u_val)); \ break; \ @@ -276,7 +276,7 @@ rrd_fetch(...) for (i = start+step; i <= end; i += step){ line = newAV(); for (ii = 0; ii < ds_cnt; ii++){ - av_push(line,(isnan(*datai) ? &PL_sv_undef : newSVnv(*datai))); + av_push(line,(isnan(*datai) ? newSV(0) : newSVnv(*datai))); datai++; } av_push(retar,newRV_noinc((SV*)line)); @@ -356,7 +356,7 @@ rrd_xport(...) for (i = start+step; i <= end; i += step){ line = newAV(); for (ii = 0; ii < col_cnt; ii++){ - av_push(line,(isnan(*ptr) ? &PL_sv_undef : newSVnv(*ptr))); + av_push(line,(isnan(*ptr) ? newSV(0) : newSVnv(*ptr))); ptr++; } av_push(retar,newRV_noinc((SV*)line));