Skip to contentSkip to conversation

gen_init_cpio: add static const qualifiers

PATCH In review Masahiro Yamada 2 participants 2 messages Oct 12, 2021 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gen_init_cpio: add static const qualifiers

Add 'const' to constant arrays. I also added missing 'static'.

---

 usr/gen_init_cpio.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
usr/gen_init_cpio.c +2 -2
index 03b21189d58b..bf5b98c6cf8d 100644
@@ -188,7 +188,7 @@ struct generic_type {
 	mode_t mode;
 };
 
-static struct generic_type generic_type_table[] = {
+static const struct generic_type generic_type_table[] = {
 	[GT_DIR] = {
 		.type = "dir",
 		.mode = S_IFDIR
@@ -491,7 +491,7 @@ static void usage(const char *prog)
 		prog);
 }
 
-struct file_handler file_handler_table[] = {
+static const struct file_handler file_handler_table[] = {
 	{
 		.type    = "file",
 		.handler = cpio_mkfile_line,
Signature · 1 line
2.30.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 3 lines · On ti. 12. okt. 2021 kl. 11.55 +0000 Masahiro Yamada wrote:

Add 'const' to constant arrays. I also added missing 'static'.

Quoted 30 lines

---

 usr/gen_init_cpio.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
usr/gen_init_cpio.c +2 -2
index 03b21189d58b..bf5b98c6cf8d 100644
@@ -188,7 +188,7 @@ struct generic_type {
 	mode_t mode;
 };
 
-static struct generic_type generic_type_table[] = {
+static const struct generic_type generic_type_table[] = {
 	[GT_DIR] = {
 		.type = "dir",
 		.mode = S_IFDIR
@@ -491,7 +491,7 @@ static void usage(const char *prog)
 		prog);
 }
 
-struct file_handler file_handler_table[] = {
+static const struct file_handler file_handler_table[] = {
 	{
 		.type    = "file",
 		.handler = cpio_mkfile_line,
Signature · 1 line
2.30.2
Signature · 3 lines
epost|xmpp: [email protected]          irc://oftc.net/nsc
↳ gpg: 18ed 52db e34f 860e e9fb  c82b 7d97 0932 55a0 ce7f
     -- frykten for herren er opphav til kunnskap --