[libvirt] [PATCH] avoid global variable shadowed

Hu Tao hutao at cn.fujitsu.com
Fri Mar 2 02:52:59 UTC 2012


If "conf/domain_conf.h" included in file nodeinfo.c, gcc complains about
a variable shadowing. fix it for potential further including of the file.

ref: https://www.redhat.com/archives/libvir-list/2012-February/msg00955.html
---
 src/nodeinfo.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/nodeinfo.c b/src/nodeinfo.c
index e0b66f7..0c86a7e 100644
--- a/src/nodeinfo.c
+++ b/src/nodeinfo.c
@@ -206,7 +206,7 @@ int linuxNodeInfoCPUPopulate(FILE *cpuinfo,
     DIR *cpudir = NULL;
     struct dirent *cpudirent = NULL;
     unsigned int cpu;
-    unsigned long core, socket, cur_threads;
+    unsigned long core, sock, cur_threads;
     cpu_set_t core_mask;
     cpu_set_t socket_mask;
     int online;
@@ -311,9 +311,9 @@ int linuxNodeInfoCPUPopulate(FILE *cpuinfo,
         }
 
         /* Parse socket */
-        socket = parse_socket(cpu);
-        if (!CPU_ISSET(socket, &socket_mask)) {
-            CPU_SET(socket, &socket_mask);
+        sock = parse_socket(cpu);
+        if (!CPU_ISSET(sock, &socket_mask)) {
+            CPU_SET(sock, &socket_mask);
             nodeinfo->sockets++;
         }
 
-- 
1.7.4.4




More information about the libvir-list mailing list