[rtems commit] libmisc/shell: Edit history hack is corrupting memory. Remove it.
Chris Johns
chrisj at rtems.org
Mon Dec 1 03:57:01 UTC 2014
Module: rtems
Branch: master
Commit: e37e8504f1b53d01de49232dd5f1236bc518cd90
Changeset: http://git.rtems.org/rtems/commit/?id=e37e8504f1b53d01de49232dd5f1236bc518cd90
Author: Chris Johns <chrisj at rtems.org>
Date: Mon Dec 1 14:53:55 2014 +1100
libmisc/shell: Edit history hack is corrupting memory. Remove it.
The hack was a debug aid and is not needed.
Close #2203.
---
cpukit/libmisc/shell/main_edit.c | 25 +------------------------
1 file changed, 1 insertion(+), 24 deletions(-)
diff --git a/cpukit/libmisc/shell/main_edit.c b/cpukit/libmisc/shell/main_edit.c
index d105e20..079e9ff 100644
--- a/cpukit/libmisc/shell/main_edit.c
+++ b/cpukit/libmisc/shell/main_edit.c
@@ -219,16 +219,6 @@ struct env {
int untitled; // Counter for untitled files
};
-/*
- * This is a hack to allow a simple way to inspect the keys to
- * add extar decoding. It is not multi-user safe.
- */
-#define KEY_HISTORY 1
-#if KEY_HISTORY
-int key_history[32];
-size_t key_history_in;
-#endif
-
//
// Editor buffer functions
//
@@ -813,19 +803,6 @@ static void get_modifier_keys(int *shift, int *ctrl) {
static int getachar(void)
{
int ch = getchar();
-#if KEY_HISTORY
- if (key_history_in < sizeof(key_history)) {
- key_history[key_history_in++] = ch;
-#if defined(__rtems__)
- } if (key_history_in > sizeof(key_history)) {
- /* eliminate possibility of using index above array bounds */
- assert( key_history_in > sizeof(key_history));
-#endif
- } else {
- memmove(&key_history[0], &key_history[1], sizeof(key_history) - sizeof(key_history[0]));
- key_history[key_history_in - 1] = ch;
- }
-#endif
return ch;
}
@@ -2155,7 +2132,7 @@ static void edit(struct editor *ed) {
#endif
#if defined(__rtems__)
/*
- * Coverity spotted this as using ed after free() so changing
+ * Coverity spotted this as using ed after free() so changing
* the order of the statements.
*/
case ctrl('w'): ed = ed->env->current; close_editor(ed); break;
More information about the vc
mailing list