Hi Anthony,
On 11/05/2021 16:18, Anthony PERARD wrote:
On Mon, Apr 05, 2021 at 04:57:08PM +0100, Julien Grall wrote:
From: Julien Grall <[email protected]>
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 <[email protected]>
---
diff --git a/tools/console/daemon/io.c b/tools/console/daemon/io.c
index 4af27ffc5d02..6a8a94e31b65 100644
--- a/tools/console/daemon/io.c
+++ b/tools/console/daemon/io.c
@@ -109,9 +109,9 @@ struct console {
};
struct console_type {
- char *xsname;
- char *ttyname;
- char *log_suffix;
+ const char *xsname;
I think that const of `xsname` is lost in console_init() in the same
file.
We have:
static int console_init(.. )
{
struct console_type **con_type = (struct console_type **)data;
char *xsname, *xspath;
xsname = (char *)(*con_type)->xsname;
}
So constify "xsname" in console_init() should be part of the patch, I
think.
Good point. I am not entirely sure why the cast has been added because
the field has always been a char *.
Anyway, I will remove it.
Cheers,
--
Julien Grall