X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=perl-module%2FPSPP.xs;h=7bb36ef3bc7468bd419a8ce2681ea00ba064baf9;hb=4ed307e3ae98c362d182bc5c8b2d79f4252ff1b8;hp=3b3dcceff82d275d55fd76986836f0044b30baac;hpb=b8e182acade7dc6f008d79221f1274fa1e3003dc;p=pspp-builds.git diff --git a/perl-module/PSPP.xs b/perl-module/PSPP.xs index 3b3dccef..7bb36ef3 100644 --- a/perl-module/PSPP.xs +++ b/perl-module/PSPP.xs @@ -55,6 +55,9 @@ struct sysfile_info /* A pointer to the dictionary. Owned externally */ const struct dictionary *dict; + + /* The scalar containing the dictionary */ + SV *dict_sv; }; @@ -471,11 +474,13 @@ MODULE = PSPP PACKAGE = PSPP::Sysfile struct sysfile_info * -pxs_create_sysfile (name, dict, opts_hr) +pxs_create_sysfile (name, dict_ref, opts_hr) char *name - struct dictionary *dict + SV *dict_ref SV *opts_hr INIT: + SV *dict_sv = SvRV (dict_ref); + struct dictionary *dict = (void *) SvIV (dict_sv); struct sfm_write_options opts; if (!SvROK (opts_hr)) { @@ -499,6 +504,8 @@ CODE: sfi->writer = sfm_open_writer (fh, dict, opts); sfi->dict = dict; sfi->opened = true; + sfi->dict_sv = dict_sv; + SvREFCNT_inc (sfi->dict_sv); RETVAL = sfi; OUTPUT: @@ -517,6 +524,7 @@ DESTROY (sfi) struct sysfile_info *sfi CODE: sysfile_close (sfi); + SvREFCNT_dec (sfi->dict_sv); free (sfi); int