[PATCH 2/3] datatypes: avoid redundant __FUNCTION__

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



virLibConnError already includes __FUNCTION__ in its output, so we
were redundant.  Furthermore, clang warns that __FUNCTION__ is not
a string literal (at least __FUNCTION__ will never contain %, so
it was not a security risk).

* src/datatypes.c: Replace __FUNCTION__ with a descriptive string.
---
 src/datatypes.c |   36 ++++++++++++++++++------------------
 1 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/src/datatypes.c b/src/datatypes.c
index 25962a6..cea8765 100644
--- a/src/datatypes.c
+++ b/src/datatypes.c
@@ -287,7 +287,7 @@ virUnrefConnect(virConnectPtr conn) {
     int refs;

     if ((!VIR_IS_CONNECT(conn))) {
-        virLibConnError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, _("no connection"));
         return(-1);
     }
     virMutexLock(&conn->lock);
@@ -345,7 +345,7 @@ virGetDomain(virConnectPtr conn, const char *name, const unsigned char *uuid) {
     virDomainPtr ret = NULL;

     if ((!VIR_IS_CONNECT(conn)) || (name == NULL) || (uuid == NULL)) {
-        virLibConnError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, _("no connection"));
         return(NULL);
     }
     virMutexLock(&conn->lock);
@@ -455,7 +455,7 @@ virUnrefDomain(virDomainPtr domain) {
     int refs;

     if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
-        virLibConnError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, _("no connection"));
         return(-1);
     }
     virMutexLock(&domain->conn->lock);
@@ -490,7 +490,7 @@ virGetNetwork(virConnectPtr conn, const char *name, const unsigned char *uuid) {
     virNetworkPtr ret = NULL;

     if ((!VIR_IS_CONNECT(conn)) || (name == NULL) || (uuid == NULL)) {
-        virLibConnError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, _("no connection"));
         return(NULL);
     }
     virMutexLock(&conn->lock);
@@ -592,7 +592,7 @@ virUnrefNetwork(virNetworkPtr network) {
     int refs;

     if (!VIR_IS_CONNECTED_NETWORK(network)) {
-        virLibConnError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, _("no connection"));
         return(-1);
     }
     virMutexLock(&network->conn->lock);
@@ -629,7 +629,7 @@ virGetInterface(virConnectPtr conn, const char *name, const char *mac) {
     virInterfacePtr ret = NULL;

     if ((!VIR_IS_CONNECT(conn)) || (name == NULL)) {
-        virLibConnError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, _("no connection"));
         return(NULL);
     }

@@ -774,7 +774,7 @@ virUnrefInterface(virInterfacePtr iface) {
     int refs;

     if (!VIR_IS_CONNECTED_INTERFACE(iface)) {
-        virLibConnError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, _("no connection"));
         return(-1);
     }
     virMutexLock(&iface->conn->lock);
@@ -810,7 +810,7 @@ virGetStoragePool(virConnectPtr conn, const char *name, const unsigned char *uui
     virStoragePoolPtr ret = NULL;

     if ((!VIR_IS_CONNECT(conn)) || (name == NULL) || (uuid == NULL)) {
-        virLibConnError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, _("no connection"));
         return(NULL);
     }
     virMutexLock(&conn->lock);
@@ -913,7 +913,7 @@ virUnrefStoragePool(virStoragePoolPtr pool) {
     int refs;

     if (!VIR_IS_CONNECTED_STORAGE_POOL(pool)) {
-        virLibConnError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, _("no connection"));
         return(-1);
     }
     virMutexLock(&pool->conn->lock);
@@ -950,7 +950,7 @@ virGetStorageVol(virConnectPtr conn, const char *pool, const char *name, const c
     virStorageVolPtr ret = NULL;

     if ((!VIR_IS_CONNECT(conn)) || (name == NULL) || (key == NULL)) {
-        virLibConnError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, _("no connection"));
         return(NULL);
     }
     virMutexLock(&conn->lock);
@@ -1062,7 +1062,7 @@ virUnrefStorageVol(virStorageVolPtr vol) {
     int refs;

     if (!VIR_IS_CONNECTED_STORAGE_VOL(vol)) {
-        virLibConnError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, _("no connection"));
         return(-1);
     }
     virMutexLock(&vol->conn->lock);
@@ -1098,7 +1098,7 @@ virGetNodeDevice(virConnectPtr conn, const char *name)
     virNodeDevicePtr ret = NULL;

     if ((!VIR_IS_CONNECT(conn)) || (name == NULL)) {
-        virLibConnError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, _("no connection"));
         return(NULL);
     }
     virMutexLock(&conn->lock);
@@ -1230,7 +1230,7 @@ virGetSecret(virConnectPtr conn, const unsigned char *uuid,
     char uuidstr[VIR_UUID_STRING_BUFLEN];

     if (!VIR_IS_CONNECT(conn) || uuid == NULL || usageID == NULL) {
-        virLibConnError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, _("no connection"));
         return NULL;
     }
     virMutexLock(&conn->lock);
@@ -1329,7 +1329,7 @@ virUnrefSecret(virSecretPtr secret) {
     int refs;

     if (!VIR_IS_CONNECTED_SECRET(secret)) {
-        virLibConnError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, _("no connection"));
         return -1;
     }
     virMutexLock(&secret->conn->lock);
@@ -1423,7 +1423,7 @@ virGetNWFilter(virConnectPtr conn, const char *name, const unsigned char *uuid)
     virNWFilterPtr ret = NULL;

     if ((!VIR_IS_CONNECT(conn)) || (name == NULL) || (uuid == NULL)) {
-        virLibConnError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, _("no connection"));
         return(NULL);
     }
     virMutexLock(&conn->lock);
@@ -1526,7 +1526,7 @@ virUnrefNWFilter(virNWFilterPtr pool) {
     int refs;

     if (!VIR_IS_CONNECTED_NWFILTER(pool)) {
-        virLibConnError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, _("no connection"));
         return -1;
     }
     virMutexLock(&pool->conn->lock);
@@ -1550,7 +1550,7 @@ virGetDomainSnapshot(virDomainPtr domain, const char *name)
     virDomainSnapshotPtr ret = NULL;

     if ((!VIR_IS_DOMAIN(domain)) || (name == NULL)) {
-        virLibConnError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, _("not a snapshot"));
         return(NULL);
     }
     virMutexLock(&domain->conn->lock);
@@ -1630,7 +1630,7 @@ virUnrefDomainSnapshot(virDomainSnapshotPtr snapshot)
     int refs;

     if (!VIR_IS_DOMAIN_SNAPSHOT(snapshot)) {
-        virLibConnError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, _("not a snapshot"));
         return(-1);
     }

-- 
1.7.0.1

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

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]