[libvirt] sexpr.c: reviving an old const-correct change

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

 



I wrote this months ago and forgot about it:

diff --git a/src/xend_internal.c b/src/xend_internal.c
index 880a279..1e6e875 100644
--- a/src/xend_internal.c
+++ b/src/xend_internal.c
@@ -2171,7 +2171,7 @@ error:
  */
 static virDomainDefPtr
 xenDaemonParseSxpr(virConnectPtr conn,
-                   struct sexpr *root,
+                   const struct sexpr *root,
                    int xendConfigVersion,
                    const char *cpus)
 {



When you pull the thread (i.e., eliminate all resulting
warnings that arise from the above change), you end up with
the following additional const-adding changes:
(I'll squash the two into a single change set before committing)


>From 1d0fd10b999ab65c555d8cb5bcfc03bc5cad9e6e Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@xxxxxxxxxx>
Date: Fri, 1 Aug 2008 15:36:31 +0200
Subject: [PATCH] xend_internal.c, sexpr.c: const-correctness

---
 src/sexpr.c         |    2 +-
 src/sexpr.h         |    2 +-
 src/xend_internal.c |   19 ++++++++++---------
 3 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/src/sexpr.c b/src/sexpr.c
index 90c549c..b607e41 100644
--- a/src/sexpr.c
+++ b/src/sexpr.c
@@ -519,7 +519,7 @@ sexpr_lookup(const struct sexpr *sexpr, const char *node)
  * Returns true if the key was found, false otherwise
  */
 int
-sexpr_has(struct sexpr *sexpr, const char *node)
+sexpr_has(const struct sexpr *sexpr, const char *node)
 {
     struct sexpr *s = sexpr_lookup_key(sexpr, node);

diff --git a/src/sexpr.h b/src/sexpr.h
index 0559a27..c3d038e 100644
--- a/src/sexpr.h
+++ b/src/sexpr.h
@@ -51,5 +51,5 @@ int sexpr_node_copy(const struct sexpr *sexpr, const char *node, char **dst);
 const char *sexpr_fmt_node(const struct sexpr *sexpr, const char *fmt, ...)
   ATTRIBUTE_FORMAT(printf,2,3);
 struct sexpr *sexpr_lookup(const struct sexpr *sexpr, const char *node);
-int sexpr_has(struct sexpr *sexpr, const char *node);
+int sexpr_has(const struct sexpr *sexpr, const char *node);
 #endif
diff --git a/src/xend_internal.c b/src/xend_internal.c
index 1e6e875..e29702a 100644
--- a/src/xend_internal.c
+++ b/src/xend_internal.c
@@ -1180,7 +1180,8 @@ xend_detect_config_version(virConnectPtr conn) {
  * Returns 0 in case of success and -1 in case of error
  */
 static int
-xenDaemonParseSxprOS(virConnectPtr xend, struct sexpr *node,
+xenDaemonParseSxprOS(virConnectPtr xend,
+		     const struct sexpr *node,
                      virDomainDefPtr def,
                      int hvm)
 {
@@ -1640,11 +1641,11 @@ error:
 static int
 xenDaemonParseSxprDisks(virConnectPtr conn,
                         virDomainDefPtr def,
-                        struct sexpr *root,
+                        const struct sexpr *root,
                         int hvm,
                         int xendConfigVersion)
 {
-    struct sexpr *cur, *node;
+    const struct sexpr *cur, *node;
     virDomainDiskDefPtr disk = NULL, prev = def->disks;

     for (cur = root; cur->kind == SEXPR_CONS; cur = cur->u.s.cdr) {
@@ -1803,10 +1804,10 @@ error:
 static int
 xenDaemonParseSxprNets(virConnectPtr conn,
                        virDomainDefPtr def,
-                       struct sexpr *root)
+                       const struct sexpr *root)
 {
     virDomainNetDefPtr net = NULL, prev = def->nets;
-    struct sexpr *cur, *node;
+    const struct sexpr *cur, *node;
     const char *tmp;
     int vif_index = 0;

@@ -1964,7 +1965,7 @@ error:
 static int
 xenDaemonParseSxprUSB(virConnectPtr conn,
                       virDomainDefPtr def,
-                      struct sexpr *root)
+                      const struct sexpr *root)
 {
     virDomainInputDefPtr prev = def->inputs;
     struct sexpr *cur, *node;
@@ -2007,7 +2008,7 @@ no_memory:
 static int
 xenDaemonParseSxprGraphicsOld(virConnectPtr conn,
                               virDomainDefPtr def,
-                              struct sexpr *root,
+                              const struct sexpr *root,
                               int hvm,
                               int xendConfigVersion)
 {
@@ -2085,10 +2086,10 @@ no_memory:
 static int
 xenDaemonParseSxprGraphicsNew(virConnectPtr conn,
                               virDomainDefPtr def,
-                              struct sexpr *root)
+                              const struct sexpr *root)
 {
     virDomainGraphicsDefPtr graphics = NULL;
-    struct sexpr *cur, *node;
+    const struct sexpr *cur, *node;
     const char *tmp;

     /* append network devices and framebuffer */
--
1.6.0.rc1.29.gf08e3

--
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]