[Libguestfs] [PATCH libguestfs 4/9] fish.c: avoid "assignment discards qualifiers..." warning

Jim Meyering jim at meyering.net
Fri Aug 21 13:28:14 UTC 2009


From: Jim Meyering <meyering at redhat.com>

* fish/fish.c (main): Cast-away-const.
* fish/fish.h (bad_cast): Define.  Safer than using an actual cast.
---
 fish/fish.c |    2 +-
 fish/fish.h |    6 ++++++
 2 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/fish/fish.c b/fish/fish.c
index 987df59..9de8e07 100644
--- a/fish/fish.c
+++ b/fish/fish.c
@@ -267,7 +267,7 @@ main (int argc, char *argv[])
         *p = '\0';
         mp->mountpoint = p+1;
       } else
-        mp->mountpoint = "/";
+        mp->mountpoint = bad_cast ("/");
       mp->device = optarg;
       mp->next = mps;
       mps = mp;
diff --git a/fish/fish.h b/fish/fish.h
index b7ed922..642c269 100644
--- a/fish/fish.h
+++ b/fish/fish.h
@@ -106,4 +106,10 @@ extern char *try_tilde_expansion (char *path);
   "reopen",				\
   "time"

+static inline char *
+bad_cast (char const *s)
+{
+  return (char *) s;
+}
+
 #endif /* FISH_H */
-- 
1.6.4.378.g88f2f




More information about the Libguestfs mailing list