[python] Fix -Wsign-compare warnings

Message ID 1f695df8e28eff5eb03a222fcf2e2d791e4370ef.1567618886.git.crobinso@redhat.com
State New
Headers show
Series
  • [python] Fix -Wsign-compare warnings
Related show

Commit Message

Cole Robinson Sept. 4, 2019, 5:41 p.m.
libvirt-override.c: In function ‘libvirt_virConnectBaselineHypervisorCPU’:
libvirt-override.c:9946:23: warning: comparison of integer expressions of different signedness: ‘size_t’ {aka ‘long unsigned int’} and ‘int’ [-Wsign-compare]
libvirt-override.c:9961:19: warning: comparison of integer expressions of different signedness: ‘size_t’ {aka ‘long unsigned int’} and ‘int’ [-Wsign-compare]

Use ssign_t as was similarly done in 75ec2acb6163b

Signed-off-by: Cole Robinson <crobinso@redhat.com>
---
 libvirt-override.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Pavel Hrdina Sept. 5, 2019, 7:49 a.m. | #1
On Wed, Sep 04, 2019 at 01:41:56PM -0400, Cole Robinson wrote:
> libvirt-override.c: In function ‘libvirt_virConnectBaselineHypervisorCPU’:

> libvirt-override.c:9946:23: warning: comparison of integer expressions of different signedness: ‘size_t’ {aka ‘long unsigned int’} and ‘int’ [-Wsign-compare]

> libvirt-override.c:9961:19: warning: comparison of integer expressions of different signedness: ‘size_t’ {aka ‘long unsigned int’} and ‘int’ [-Wsign-compare]

> 

> Use ssign_t as was similarly done in 75ec2acb6163b

> 

> Signed-off-by: Cole Robinson <crobinso@redhat.com>

> ---

>  libvirt-override.c | 2 +-

>  1 file changed, 1 insertion(+), 1 deletion(-)


Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Ján Tomko Sept. 5, 2019, 7:50 a.m. | #2
On Wed, Sep 04, 2019 at 01:41:56PM -0400, Cole Robinson wrote:
>libvirt-override.c: In function ‘libvirt_virConnectBaselineHypervisorCPU’:

>libvirt-override.c:9946:23: warning: comparison of integer expressions of different signedness: ‘size_t’ {aka ‘long unsigned int’} and ‘int’ [-Wsign-compare]

>libvirt-override.c:9961:19: warning: comparison of integer expressions of different signedness: ‘size_t’ {aka ‘long unsigned int’} and ‘int’ [-Wsign-compare]

>

>Use ssign_t as was similarly done in 75ec2acb6163b


s/sign/size/

>

>Signed-off-by: Cole Robinson <crobinso@redhat.com>

>---

> libvirt-override.c | 2 +-

> 1 file changed, 1 insertion(+), 1 deletion(-)

>


Reviewed-by: Ján Tomko <jtomko@redhat.com>


Jano
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Patch

diff --git a/libvirt-override.c b/libvirt-override.c
index 5567f4a..ff2cfdf 100644
--- a/libvirt-override.c
+++ b/libvirt-override.c
@@ -9927,7 +9927,7 @@  libvirt_virConnectBaselineHypervisorCPU(PyObject *self ATTRIBUTE_UNUSED,
     unsigned int flags;
     char **xmlCPUs = NULL;
     int ncpus = 0;
-    size_t i;
+    ssize_t i;
     char *cpu;
     PyObject *ret = NULL;