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

Re: [PATCH 05/14] tools/libs: guest: Use const whenever we point to literal strings

Hi Anthony,

On 11/05/2021 15:58, Anthony PERARD wrote:
On Mon, Apr 05, 2021 at 04:57:04PM +0100, Julien Grall wrote:
From: Julien Grall <jgrall@xxxxxxxxxx>

literal strings are not meant to be modified. So we should use const
*char rather than char * when we want to store a pointer to them.

Signed-off-by: Julien Grall <jgrall@xxxxxxxxxx>
diff --git a/tools/libs/guest/xg_dom_x86.c b/tools/libs/guest/xg_dom_x86.c
index 2953aeb90b35..e379b07f9945 100644
--- a/tools/libs/guest/xg_dom_x86.c
+++ b/tools/libs/guest/xg_dom_x86.c
@@ -1148,11 +1148,12 @@ static int vcpu_hvm(struct xc_dom_image *dom)
/* ------------------------------------------------------------------------ */ -static int x86_compat(xc_interface *xch, uint32_t domid, char *guest_type)
+static int x86_compat(xc_interface *xch, uint32_t domid,
+                      const char *guest_type)
      static const struct {
-        char           *guest;
-        uint32_t        size;
+        const char      *guest;
+        uint32_t       size;

It seems that one space have been removed by mistake just before "size".

Well spotted. I will fix on commit.

The rest looks good:
Reviewed-by: Anthony PERARD <anthony.perard@xxxxxxxxxx>

Thank you!


Julien Grall



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.