Skip to contentSkip to conversation

cmd: nvedit: Mark a few functions static

PATCH In review Andy Shevchenko 3 participants 3 messages Oct 21, 2024 – Oct 24, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cmd: nvedit: Mark a few functions static

Some functions are not used anywhere except the same file where they are defined. Mark them static. This helps avoiding the compiler warnings:

cmd/nvedit.c:201:5: warning: no previous prototype for ‘do_env_ask’ [-Wmissing-prototypes] cmd/nvedit.c:315:5: warning: no previous prototype for ‘do_env_callback’ [-Wmissing-prototypes] cmd/nvedit.c:384:5: warning: no previous prototype for ‘do_env_flags’ [-Wmissing-prototype ]

---
 cmd/nvedit.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
cmd/nvedit.c +4 -4
index 98a687bcabbd..0bd4799dc5a2 100644
@@ -198,7 +198,7 @@ static int do_env_set(struct cmd_tbl *cmdtp, int flag, int argc,
  * Prompt for environment variable
  */
 #if defined(CONFIG_CMD_ASKENV)
-int do_env_ask(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
+static int do_env_ask(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	char message[CONFIG_SYS_CBSIZE];
 	int i, len, pos, size;
@@ -312,8 +312,8 @@ static int print_active_callback(struct env_entry *entry)
 /*
  * Print the callbacks available and what they are bound to
  */
-int do_env_callback(struct cmd_tbl *cmdtp, int flag, int argc,
-		    char *const argv[])
+static int do_env_callback(struct cmd_tbl *cmdtp, int flag, int argc,
+			   char *const argv[])
 {
 	struct env_clbk_tbl *clbkp;
 	int i;
@@ -381,7 +381,7 @@ static int print_active_flags(struct env_entry *entry)
 /*
  * Print the flags available and what variables have flags
  */
-int do_env_flags(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
+static int do_env_flags(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	/* Print the available variable types */
 	printf("Available variable type flags (position %d):\n",
Signature · 1 line
2.43.0.rc1.1336.g36b5255a03ac
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Andy Shevchenko

Some functions are not used anywhere except the same file where they are defined. Mark them static. This helps avoiding the compiler warnings:

Quoted 9 lines

cmd/nvedit.c:201:5: warning: no previous prototype for ‘do_env_ask’ [-Wmissing-prototypes] cmd/nvedit.c:315:5: warning: no previous prototype for ‘do_env_callback’ [-Wmissing-prototypes] cmd/nvedit.c:384:5: warning: no previous prototype for ‘do_env_flags’ [-Wmissing-prototype ]

---
 cmd/nvedit.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
Quoted 36 lines
cmd/nvedit.c +4 -5
index 98a687bcabbd..0bd4799dc5a2 100644
@@ -198,7 +198,7 @@ static int do_env_set(struct cmd_tbl *cmdtp, int flag, int argc,
  * Prompt for environment variable
  */
 #if defined(CONFIG_CMD_ASKENV)
-int do_env_ask(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
+static int do_env_ask(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
        char message[CONFIG_SYS_CBSIZE];
        int i, len, pos, size;
@@ -312,8 +312,8 @@ static int print_active_callback(struct env_entry *entry)
 /*
  * Print the callbacks available and what they are bound to
  */
-int do_env_callback(struct cmd_tbl *cmdtp, int flag, int argc,
-                   char *const argv[])
+static int do_env_callback(struct cmd_tbl *cmdtp, int flag, int argc,
+                          char *const argv[])
 {
        struct env_clbk_tbl *clbkp;
        int i;
@@ -381,7 +381,7 @@ static int print_active_flags(struct env_entry *entry)
 /*
  * Print the flags available and what variables have flags
  */
-int do_env_flags(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
+static int do_env_flags(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
        /* Print the available variable types */
        printf("Available variable type flags (position %d):\n",
--

2.43.0.rc1.1336.g36b5255a03ac

#2 lore raw
In reply to Andy Shevchenko
Quoted 9 lines · Andy Shevchenko

Some functions are not used anywhere except the same file where they are defined. Mark them static. This helps avoiding the compiler warnings:

cmd/nvedit.c:201:5: warning: no previous prototype for ‘do_env_ask’ [-Wmissing-prototypes] cmd/nvedit.c:315:5: warning: no previous prototype for ‘do_env_callback’ [-Wmissing-prototypes] cmd/nvedit.c:384:5: warning: no previous prototype for ‘do_env_flags’ [-Wmissing-prototype ]

[...]

Applied to u-boot/master, thanks!

Signature · 1 line
Tom