[PATCH 06/36] cli: Use unsigned int instead of unsigned long

Simon Glass sjg at chromium.org
Tue Sep 19 20:08:36 CEST 2023


The index values are not very large so it makes no sense to use a long
integer. Change these to uint instead.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 common/cli_readline.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/common/cli_readline.c b/common/cli_readline.c
index 687e239bfa7..f863404110c 100644
--- a/common/cli_readline.c
+++ b/common/cli_readline.c
@@ -171,7 +171,7 @@ static char *hist_next(void)
 void cread_print_hist_list(void)
 {
 	int i;
-	unsigned long n;
+	uint n;
 
 	n = hist_num - hist_max;
 
@@ -211,10 +211,10 @@ void cread_print_hist_list(void)
 	}					\
 }
 
-static void cread_add_char(char ichar, int insert, unsigned long *num,
-	       unsigned long *eol_num, char *buf, unsigned long len)
+static void cread_add_char(char ichar, int insert, uint *num,
+			   uint *eol_num, char *buf, uint len)
 {
-	unsigned long wlen;
+	uint wlen;
 
 	/* room ??? */
 	if (insert || *num == *eol_num) {
@@ -245,8 +245,7 @@ static void cread_add_char(char ichar, int insert, unsigned long *num,
 }
 
 static void cread_add_str(char *str, int strsize, int insert,
-			  unsigned long *num, unsigned long *eol_num,
-			  char *buf, unsigned long len)
+			  uint *num, uint *eol_num, char *buf, uint len)
 {
 	while (strsize--) {
 		cread_add_char(*str, insert, num, eol_num, buf, len);
@@ -258,9 +257,9 @@ static int cread_line(const char *const prompt, char *buf, unsigned int *len,
 		int timeout)
 {
 	struct cli_ch_state s_cch, *cch = &s_cch;
-	unsigned long num = 0;
-	unsigned long eol_num = 0;
-	unsigned long wlen;
+	uint num = 0;
+	uint eol_num = 0;
+	uint wlen;
 	char ichar;
 	int insert = 1;
 	int init_len = strlen(buf);
-- 
2.42.0.459.ge4e396fd5e-goog



More information about the U-Boot mailing list