projects
/
pspp-builds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Ensure that dict survives sysfile
[pspp-builds.git]
/
perl-module
/
PSPP.xs
diff --git
a/perl-module/PSPP.xs
b/perl-module/PSPP.xs
index b468cc7467325a322378ad5970d19eb2b8a12b21..6373bc37dea1c4fa540c19315743900f47ef80d3 100644
(file)
--- 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;
/* 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 *
struct sysfile_info *
-pxs_create_sysfile (name, dict, opts_hr)
+pxs_create_sysfile (name, dict
_ref
, opts_hr)
char *name
char *name
- struct dictionary *dict
+ SV *dict_ref
SV *opts_hr
INIT:
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))
{
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->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:
RETVAL = sfi;
OUTPUT:
@@
-500,6
+507,7
@@
DESTROY (sfi)
struct sysfile_info *sfi
CODE:
sysfile_close (sfi);
struct sysfile_info *sfi
CODE:
sysfile_close (sfi);
+ SvREFCNT_dec (sfi->dict_sv);
free (sfi);
int
free (sfi);
int