X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=perl-module%2FPSPP.xs;h=6373bc37dea1c4fa540c19315743900f47ef80d3;hb=09669b94dcfcb20c354f454f34c1445a260e2980;hp=b468cc7467325a322378ad5970d19eb2b8a12b21;hpb=aee574220dad196b9e5a872e3afe930275a79bfa;p=pspp-builds.git diff --git a/perl-module/PSPP.xs b/perl-module/PSPP.xs index b468cc74..6373bc37 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; }; @@ -454,11 +457,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)) { @@ -482,6 +487,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: @@ -500,6 +507,7 @@ DESTROY (sfi) struct sysfile_info *sfi CODE: sysfile_close (sfi); + SvREFCNT_dec (sfi->dict_sv); free (sfi); int