Pino Toscano
2016-May-06 13:30 UTC
[Libguestfs] [PATCH] perl: use INT2PTR macro for casting back to guestfs_h * (RHBZ#1150298)
Use the right macro, which should avoid the warnings seen with Perl headers on some architecture. --- generator/perl.ml | 2 +- perl/typemap | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/generator/perl.ml b/generator/perl.ml index 19cabb6..a665051 100644 --- a/generator/perl.ml +++ b/generator/perl.ml @@ -242,7 +242,7 @@ DESTROY (sv) HV *hv = (HV *) SvRV (sv); SV **svp = hv_fetch (hv, \"_g\", 2, 0); if (svp != NULL) { - guestfs_h *g = (guestfs_h *) SvIV (*svp); + guestfs_h *g = INT2PTR (guestfs_h *, SvIV (*svp)); _close_handle (g); } diff --git a/perl/typemap b/perl/typemap index 508e378..0a92e53 100644 --- a/perl/typemap +++ b/perl/typemap @@ -14,7 +14,7 @@ O_OBJECT_guestfs_h SV **svp = hv_fetch (hv, \"_g\", 2, 0); if (svp == NULL) croak (\"${Package}::$func_name(): called on a closed handle\"); - $var = ($type) SvIV (*svp); + $var = INT2PTR ($type, SvIV (*svp)); } else { croak (\"${Package}::$func_name(): $var is not a blessed HV reference\"); } -- 2.5.5
Richard W.M. Jones
2016-May-06 20:23 UTC
Re: [Libguestfs] [PATCH] perl: use INT2PTR macro for casting back to guestfs_h * (RHBZ#1150298)
On Fri, May 06, 2016 at 03:30:28PM +0200, Pino Toscano wrote:> Use the right macro, which should avoid the warnings seen with Perl > headers on some architecture. > --- > generator/perl.ml | 2 +- > perl/typemap | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/generator/perl.ml b/generator/perl.ml > index 19cabb6..a665051 100644 > --- a/generator/perl.ml > +++ b/generator/perl.ml > @@ -242,7 +242,7 @@ DESTROY (sv) > HV *hv = (HV *) SvRV (sv); > SV **svp = hv_fetch (hv, \"_g\", 2, 0); > if (svp != NULL) { > - guestfs_h *g = (guestfs_h *) SvIV (*svp); > + guestfs_h *g = INT2PTR (guestfs_h *, SvIV (*svp)); > _close_handle (g); > } > > diff --git a/perl/typemap b/perl/typemap > index 508e378..0a92e53 100644 > --- a/perl/typemap > +++ b/perl/typemap > @@ -14,7 +14,7 @@ O_OBJECT_guestfs_h > SV **svp = hv_fetch (hv, \"_g\", 2, 0); > if (svp == NULL) > croak (\"${Package}::$func_name(): called on a closed handle\"); > - $var = ($type) SvIV (*svp); > + $var = INT2PTR ($type, SvIV (*svp)); > } else { > croak (\"${Package}::$func_name(): $var is not a blessed HV reference\"); > } > -- > 2.5.5ACK. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-builder quickly builds VMs from scratch http://libguestfs.org/virt-builder.1.html