Older compilers fail to see that 'close' is not used a function
rather than a variable and produce the following error:
cc1: warnings being treated as errors
../../src/datatypes.c: In function 'virConnectCloseCallbackDataReset':
../../src/datatypes.c:149: error: declaration of 'close' shadows a global
declaration [-Wshadow]
Replace all the 'close' occurrences with 'closeData' to resolve
this.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/datatypes.c | 72 ++++++++++++++++++++++++++++-----------------------------
1 file changed, 36 insertions(+), 36 deletions(-)
diff --git a/src/datatypes.c b/src/datatypes.c
index 163db39..696e8c0 100644
--- a/src/datatypes.c
+++ b/src/datatypes.c
@@ -145,16 +145,16 @@ virConnectDispose(void *obj)
}
-static
-void virConnectCloseCallbackDataReset(virConnectCloseCallbackDataPtr close)
+static void
+virConnectCloseCallbackDataReset(virConnectCloseCallbackDataPtr closeData)
{
- if (close->freeCallback)
- close->freeCallback(close->opaque);
+ if (closeData->freeCallback)
+ closeData->freeCallback(closeData->opaque);
- close->freeCallback = NULL;
- close->opaque = NULL;
- virObjectUnref(close->conn);
- close->conn = NULL;
+ closeData->freeCallback = NULL;
+ closeData->opaque = NULL;
+ virObjectUnref(closeData->conn);
+ closeData->conn = NULL;
}
/**
@@ -178,77 +178,77 @@ virNewConnectCloseCallbackData(void)
return virObjectLockableNew(virConnectCloseCallbackDataClass);
}
-void virConnectCloseCallbackDataRegister(virConnectCloseCallbackDataPtr close,
+void virConnectCloseCallbackDataRegister(virConnectCloseCallbackDataPtr closeData,
virConnectPtr conn,
virConnectCloseFunc cb,
void *opaque,
virFreeCallback freecb)
{
- virObjectLock(close);
+ virObjectLock(closeData);
- if (close->callback != NULL) {
+ if (closeData->callback != NULL) {
VIR_WARN("Attempt to register callback on armed"
- " close callback object %p", close);
+ " close callback object %p", closeData);
goto cleanup;
return;
}
- close->conn = conn;
- virObjectRef(close->conn);
- close->callback = cb;
- close->opaque = opaque;
- close->freeCallback = freecb;
+ closeData->conn = conn;
+ virObjectRef(closeData->conn);
+ closeData->callback = cb;
+ closeData->opaque = opaque;
+ closeData->freeCallback = freecb;
cleanup:
- virObjectUnlock(close);
+ virObjectUnlock(closeData);
}
-void virConnectCloseCallbackDataUnregister(virConnectCloseCallbackDataPtr close,
+void virConnectCloseCallbackDataUnregister(virConnectCloseCallbackDataPtr closeData,
virConnectCloseFunc cb)
{
- virObjectLock(close);
+ virObjectLock(closeData);
- if (close->callback != cb) {
+ if (closeData->callback != cb) {
VIR_WARN("Attempt to unregister different callback on "
- " close callback object %p", close);
+ " close callback object %p", closeData);
goto cleanup;
}
- virConnectCloseCallbackDataReset(close);
- close->callback = NULL;
+ virConnectCloseCallbackDataReset(closeData);
+ closeData->callback = NULL;
cleanup:
- virObjectUnlock(close);
+ virObjectUnlock(closeData);
}
-void virConnectCloseCallbackDataCall(virConnectCloseCallbackDataPtr close,
+void virConnectCloseCallbackDataCall(virConnectCloseCallbackDataPtr closeData,
int reason)
{
- virObjectLock(close);
+ virObjectLock(closeData);
- if (!close->conn)
+ if (!closeData->conn)
goto exit;
VIR_DEBUG("Triggering connection close callback %p reason=%d, opaque=%p",
- close->callback, reason, close->opaque);
- close->callback(close->conn, reason, close->opaque);
+ closeData->callback, reason, closeData->opaque);
+ closeData->callback(closeData->conn, reason, closeData->opaque);
- virConnectCloseCallbackDataReset(close);
+ virConnectCloseCallbackDataReset(closeData);
exit:
- virObjectUnlock(close);
+ virObjectUnlock(closeData);
}
virConnectCloseFunc
-virConnectCloseCallbackDataGetCallback(virConnectCloseCallbackDataPtr close)
+virConnectCloseCallbackDataGetCallback(virConnectCloseCallbackDataPtr closeData)
{
virConnectCloseFunc cb;
- virObjectLock(close);
- cb = close->callback;
- virObjectUnlock(close);
+ virObjectLock(closeData);
+ cb = closeData->callback;
+ virObjectUnlock(closeData);
return cb;
}
--
2.4.10
Show replies by date
On 01.03.2016 17:43, Michal Privoznik wrote:
Older compilers fail to see that 'close' is not used a
function
rather than a variable and produce the following error:
cc1: warnings being treated as errors
../../src/datatypes.c: In function 'virConnectCloseCallbackDataReset':
../../src/datatypes.c:149: error: declaration of 'close' shadows a global
declaration [-Wshadow]
Replace all the 'close' occurrences with 'closeData' to resolve
this.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/datatypes.c | 72 ++++++++++++++++++++++++++++-----------------------------
1 file changed, 36 insertions(+), 36 deletions(-)
Since this qualifies as a build breaker, I've pushed this one.
Michal