[Libguestfs] [PATCH libguestfs 4/9] fish.c: avoid "assignment discards qualifiers..." warning
Richard W.M. Jones
rjones at redhat.com
Fri Aug 21 13:35:30 UTC 2009
On Fri, Aug 21, 2009 at 03:28:14PM +0200, Jim Meyering wrote:
> 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 */
I guess we never free the array mps, so this is OK.
ACK.
Rich.
--
Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones
virt-p2v converts physical machines to virtual machines. Boot with a
live CD or over the network (PXE) and turn machines into Xen guests.
http://et.redhat.com/~rjones/virt-p2v
More information about the Libguestfs
mailing list