From 883d4d1310137ca2cb94919b3cc6b2917ff38202 Mon Sep 17 00:00:00 2001 From: John Darrington Date: Wed, 12 Sep 2012 09:26:21 +0200 Subject: [PATCH] Perl Module: Avoid forcing scalar value into a pointer. The code fragment: struct dictionary *dict = (void *) SvIV (dict_sv); is dangerous. This fix uses the properl Perl XS mechanism to get the pointer and the scalar associated with the dictionary. Reviewed-By: Ben Pfaff --- perl-module/PSPP.xs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/perl-module/PSPP.xs b/perl-module/PSPP.xs index 834ec401f4..a66f442729 100644 --- a/perl-module/PSPP.xs +++ b/perl-module/PSPP.xs @@ -568,13 +568,12 @@ MODULE = PSPP PACKAGE = PSPP::Sysfile struct sysfile_info * -pxs_create_sysfile (name, dict_ref, opts_hr) +pxs_create_sysfile (name, dict, opts_hr) char *name - SV *dict_ref + struct dictionary *dict; SV *opts_hr INIT: - SV *dict_sv = SvRV (dict_ref); - struct dictionary *dict = (void *) SvIV (dict_sv); + SV *dict_sv = ST(1); struct sfm_write_options opts; if (!SvROK (opts_hr)) { -- 2.30.2