[PATCH 05/36] Remove unnecessary casts in key defines

Sascha Hauer s.hauer at pengutronix.de
Fri Dec 18 10:47:54 EST 2009


Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 commands/edit.c   |    2 +-
 include/readkey.h |   12 ++++++------
 lib/readkey.c     |    2 +-
 lib/readline.c    |    6 +++---
 4 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/commands/edit.c b/commands/edit.c
index 6503edf..d292a52 100644
--- a/commands/edit.c
+++ b/commands/edit.c
@@ -394,7 +394,7 @@ static int do_edit(cmd_tbl_t * cmdtp, int argc, char *argv[])
 	int lastscrcol;
 	int i;
 	int linepos;
-	char c;
+	int c;
 
 	if (argc != 2)
 		return COMMAND_ERROR_USAGE;
diff --git a/include/readkey.h b/include/readkey.h
index d27f0b4..d073e43 100644
--- a/include/readkey.h
+++ b/include/readkey.h
@@ -14,15 +14,15 @@
 #define KEY_ERASE_LINE		CTL_CH('x')
 #define KEY_INSERT		CTL_CH('o')
 #define KEY_CLEAR_SCREEN	CTL_CH('l')
-#define KEY_DEL7		(char)127
-#define KEY_END			(char)133	// Cursor Key End
-#define KEY_PAGEUP		(char)135	// Cursor Key Page Up
-#define KEY_PAGEDOWN		(char)136	// Cursor Key Page Down
-#define KEY_DEL			(char)137	// Cursor Key Del
+#define KEY_DEL7		127
+#define KEY_END			133		// Cursor Key End
+#define KEY_PAGEUP		135		// Cursor Key Page Up
+#define KEY_PAGEDOWN		136		// Cursor Key Page Down
+#define KEY_DEL			137		// Cursor Key Del
 
 #define ANSI_CLEAR_SCREEN "\e[2J\e[;H"
 
-char read_key(void);
+int read_key(void);
 
 #endif /* READKEY_H */
 
diff --git a/lib/readkey.c b/lib/readkey.c
index 0464ce4..a42d1cb 100644
--- a/lib/readkey.c
+++ b/lib/readkey.c
@@ -52,7 +52,7 @@ static const struct esc_cmds esccmds[] = {
 	{"[6~", KEY_PAGEDOWN},// Cursor Key Page Down
 };
 
-char read_key(void)
+int read_key(void)
 {
 	char c;
 	char esc[5];
diff --git a/lib/readline.c b/lib/readline.c
index 750da3b..b82150e 100644
--- a/lib/readline.c
+++ b/lib/readline.c
@@ -17,8 +17,8 @@
 #define MAX_CMDBUF_SIZE		256
 
 #define CTL_BACKSPACE		('\b')
-#define DEL			((char)255)
-#define DEL7			((char)127)
+#define DEL			255
+#define DEL7			127
 #define CREAD_HIST_CHAR		('!')
 
 #define getcmd_putch(ch)	putchar(ch)
@@ -178,7 +178,7 @@ int readline(const char *prompt, char *buf, int len)
 	unsigned long eol_num = 0;
 	unsigned long rlen;
 	unsigned long wlen;
-	unsigned char ichar;
+	int ichar;
 	int insert = 1;
 	int rc = 0;
 #ifdef CONFIG_AUTO_COMPLETE
-- 
1.6.5.2




More information about the barebox mailing list