[PATCH 14/15] maint: avoid 'const fooPtr' in all remaining places

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

 



'const fooPtr' is the same as 'foo * const' (the pointer won't
change, but it's contents can).  But in general, if an interface
is trying to be const-correct, it should be using 'const foo *'
(the pointer is to data that can't be changed).

Fix up all remaining offenders.

* src/lxc/lxc_process.c (virLXCProcessSetupInterfaceBridged): Drop
needless const.
* src/uml/uml_driver.c (umlMonitorCommand): Use intended type.
(umlMonitorAddress): Fix fallout.
* src/xen/xm_internal.c (xenXMDomainSearchForUUID): Use intended type.

Signed-off-by: Eric Blake <eblake@xxxxxxxxxx>
---
 src/lxc/lxc_process.c | 4 ++--
 src/uml/uml_driver.c  | 9 +++++----
 src/xen/xm_internal.c | 4 ++--
 3 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c
index d07ff13..dde393c 100644
--- a/src/lxc/lxc_process.c
+++ b/src/lxc/lxc_process.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010-2012 Red Hat, Inc.
+ * Copyright (C) 2010-2013 Red Hat, Inc.
  * Copyright IBM Corp. 2008
  *
  * lxc_process.c: LXC process lifecycle management
@@ -246,7 +246,7 @@ char *virLXCProcessSetupInterfaceBridged(virConnectPtr conn,
     char *ret = NULL;
     char *parentVeth;
     char *containerVeth = NULL;
-    const virNetDevVPortProfilePtr vport = virDomainNetGetActualVirtPortProfile(net);
+    virNetDevVPortProfilePtr vport = virDomainNetGetActualVirtPortProfile(net);

     VIR_DEBUG("calling vethCreate()");
     parentVeth = net->ifname;
diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c
index b9b977a..9ac896a 100644
--- a/src/uml/uml_driver.c
+++ b/src/uml/uml_driver.c
@@ -141,7 +141,7 @@ static void umlShutdownVMDaemon(struct uml_driver *driver,


 static int umlMonitorCommand(const struct uml_driver *driver,
-                             const virDomainObjPtr vm,
+                             const virDomainObj *vm,
                              const char *cmd,
                              char **reply);

@@ -836,8 +836,9 @@ reopen:
 }

 static int umlMonitorAddress(const struct uml_driver *driver,
-                             virDomainObjPtr vm,
-                             struct sockaddr_un *addr) {
+                             const virDomainObj *vm,
+                             struct sockaddr_un *addr)
+{
     char *sockname;
     int retval = 0;

@@ -918,7 +919,7 @@ struct monitor_response {


 static int umlMonitorCommand(const struct uml_driver *driver,
-                             const virDomainObjPtr vm,
+                             const virDomainObj *vm,
                              const char *cmd,
                              char **reply)
 {
diff --git a/src/xen/xm_internal.c b/src/xen/xm_internal.c
index d20dd91..d9a3502 100644
--- a/src/xen/xm_internal.c
+++ b/src/xen/xm_internal.c
@@ -860,8 +860,8 @@ xenXMDomainSearchForUUID(const void *payload,
                          const void *name ATTRIBUTE_UNUSED,
                          const void *data)
 {
-    const unsigned char *wantuuid = (const unsigned char *)data;
-    const xenXMConfCachePtr entry = (const xenXMConfCachePtr)payload;
+    const unsigned char *wantuuid = data;
+    const xenXMConfCache *entry = payload;

     if (!memcmp(entry->def->uuid, wantuuid, VIR_UUID_BUFLEN))
         return 1;
-- 
1.8.3.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]