[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH 07/14] tools/xl: Use const whenever we point to literal strings
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> --- tools/xl/xl.h | 8 ++++---- tools/xl/xl_console.c | 2 +- tools/xl/xl_utils.c | 4 ++-- tools/xl/xl_utils.h | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/tools/xl/xl.h b/tools/xl/xl.h index 137a29077c1e..3052e3db0072 100644 --- a/tools/xl/xl.h +++ b/tools/xl/xl.h @@ -21,13 +21,13 @@ #include <xentoollog.h> struct cmd_spec { - char *cmd_name; + const char *cmd_name; int (*cmd_impl)(int argc, char **argv); int can_dryrun; int modifies; - char *cmd_desc; - char *cmd_usage; - char *cmd_option; + const char *cmd_desc; + const char *cmd_usage; + const char *cmd_option; }; struct domain_create { diff --git a/tools/xl/xl_console.c b/tools/xl/xl_console.c index 4e65d7386733..b27f9e013697 100644 --- a/tools/xl/xl_console.c +++ b/tools/xl/xl_console.c @@ -27,7 +27,7 @@ int main_console(int argc, char **argv) uint32_t domid; int opt = 0, num = 0; libxl_console_type type = 0; - char *console_names = "pv, serial, vuart"; + const char *console_names = "pv, serial, vuart"; SWITCH_FOREACH_OPT(opt, "n:t:", NULL, "console", 1) { case 't': diff --git a/tools/xl/xl_utils.c b/tools/xl/xl_utils.c index 4503ac7ea03c..17489d182954 100644 --- a/tools/xl/xl_utils.c +++ b/tools/xl/xl_utils.c @@ -27,7 +27,7 @@ #include "xl.h" #include "xl_utils.h" -void dolog(const char *file, int line, const char *func, char *fmt, ...) +void dolog(const char *file, int line, const char *func, const char *fmt, ...) { va_list ap; char *s = NULL; @@ -248,7 +248,7 @@ void print_bitmap(uint8_t *map, int maplen, FILE *stream) } } -int do_daemonize(char *name, const char *pidfile) +int do_daemonize(const char *name, const char *pidfile) { char *fullname; pid_t child1; diff --git a/tools/xl/xl_utils.h b/tools/xl/xl_utils.h index d98b419f1075..0c337ede954b 100644 --- a/tools/xl/xl_utils.h +++ b/tools/xl/xl_utils.h @@ -123,7 +123,7 @@ int def_getopt(int argc, char * const argv[], const struct option *longopts, const char* helpstr, int reqargs); -void dolog(const char *file, int line, const char *func, char *fmt, ...) +void dolog(const char *file, int line, const char *func, const char *fmt, ...) __attribute__((format(printf,4,5))); void xvasprintf(char **strp, const char *fmt, va_list ap) @@ -143,7 +143,7 @@ uint32_t find_domain(const char *p) __attribute__((warn_unused_result)); void print_bitmap(uint8_t *map, int maplen, FILE *stream); -int do_daemonize(char *name, const char *pidfile); +int do_daemonize(const char *name, const char *pidfile); #endif /* XL_UTILS_H */ /* -- 2.17.1
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |