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

[xen staging] tools/misc: Use const whenever we point to literal strings

commit 5605cfd49a18df41a21fb50cd81528312a39d7c9
Author:     Julien Grall <jgrall@xxxxxxxxxx>
AuthorDate: Tue May 18 14:50:32 2021 +0100
Commit:     Julien Grall <jgrall@xxxxxxxxxx>
CommitDate: Tue May 18 14:54:05 2021 +0100

    tools/misc: Use const whenever we point to literal strings
    literal strings are not meant to be modified. So we should use const
    char * rather than char * when we we to store a pointer to them.
    Signed-off-by: Julien Grall <jgrall@xxxxxxxxxx>
    Reviewed-by: Anthony PERARD <anthony.perard@xxxxxxxxxx>
    Acked-by: Wei Liu <wl@xxxxxxx>
 tools/misc/xen-detect.c | 2 +-
 tools/misc/xenhypfs.c   | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/misc/xen-detect.c b/tools/misc/xen-detect.c
index eac9e46a35..18b28dabf3 100644
--- a/tools/misc/xen-detect.c
+++ b/tools/misc/xen-detect.c
@@ -44,7 +44,7 @@ enum guest_type {
     XEN_NONE = 3
-static char *type;
+static const char *type;
 static char *ver;
 static void cpuid(uint32_t idx, uint32_t *regs, int pv_context)
diff --git a/tools/misc/xenhypfs.c b/tools/misc/xenhypfs.c
index 5da24aed90..df398b07bd 100644
--- a/tools/misc/xenhypfs.c
+++ b/tools/misc/xenhypfs.c
@@ -81,9 +81,9 @@ static int xenhypfs_wr(char *path, char *val)
     return ret;
-static char *xenhypfs_type(struct xenhypfs_dirent *ent)
+static const char *xenhypfs_type(struct xenhypfs_dirent *ent)
-    char *res;
+    const char *res;
     switch (ent->type) {
     case xenhypfs_type_dir:
@@ -134,7 +134,7 @@ static int xenhypfs_ls(char *path)
     return ret;
-static int xenhypfs_tree_sub(char *path, unsigned int depth)
+static int xenhypfs_tree_sub(const char *path, unsigned int depth)
     struct xenhypfs_dirent *ent;
     unsigned int n, i;
generated by git-patchbot for /home/xen/git/xen.git#staging



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