There's a warning about type-punning in CVS libvirt.

We normally rewrite the code generated by glibc rpcgen to avoid these
warnings, but because the variable in question has a name containing
an uppercase letter, and because the regexp we're using is
case-sensitive and only matches lowercase identifiers, the rewrite
wasn't happening.

Attached patch fixes this.

Rich.

-- 
Richard Jones, Emerging Technologies, Red Hat  http://et.redhat.com/~rjones
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://et.redhat.com/~rjones/virt-top
Index: qemud/remote_protocol.c
===================================================================
RCS file: /data/cvs/libvirt/qemud/remote_protocol.c,v
retrieving revision 1.11
diff -u -r1.11 remote_protocol.c
--- qemud/remote_protocol.c     22 May 2008 15:20:25 -0000      1.11
+++ qemud/remote_protocol.c     22 May 2008 17:01:20 -0000
@@ -400,8 +400,9 @@
 bool_t
 xdr_remote_node_get_cells_free_memory_ret (XDR *xdrs, 
remote_node_get_cells_free_memory_ret *objp)
 {
+        char **objp_cpp0 = (char **) (void *) &objp->freeMems.freeMems_val;
 
-         if (!xdr_array (xdrs, (char **)&objp->freeMems.freeMems_val, (u_int 
*) &objp->freeMems.freeMems_len, REMOTE_NODE_MAX_CELLS,
+         if (!xdr_array (xdrs, objp_cpp0, (u_int *) 
&objp->freeMems.freeMems_len, REMOTE_NODE_MAX_CELLS,
                 sizeof (quad_t), (xdrproc_t) xdr_quad_t))
                  return FALSE;
         return TRUE;
Index: qemud/rpcgen_fix.pl
===================================================================
RCS file: /data/cvs/libvirt/qemud/rpcgen_fix.pl,v
retrieving revision 1.2
diff -u -r1.2 rpcgen_fix.pl
--- qemud/rpcgen_fix.pl 22 May 2008 15:20:25 -0000      1.2
+++ qemud/rpcgen_fix.pl 22 May 2008 17:01:22 -0000
@@ -46,7 +46,7 @@
        my %uses = ();
        my $i = 0;
        foreach (@function) {
-           $uses{$1} = $i++ if m/\(char \*\*\)\&(objp->[a-z_.]+_val)/;
+           $uses{$1} = $i++ if m/\(char \*\*\)\&(objp->[a-z_.]+_val)/i;
        }
        if (keys %uses >= 1) {
            my $i = 1;
@@ -59,7 +59,7 @@
            }
            @function =
                map { s{\(char \*\*\)\&(objp->[a-z_.]+_val)}
-                      {objp_cpp$uses{$1}}g; $_ } @function;
+                      {objp_cpp$uses{$1}}gi; $_ } @function;
        }
 
        # The code uses 'IXDR_PUT_{U_,}LONG' but it's wrong in two
--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to