summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJennifer Averett <Jennifer.Averett@OARcorp.com>2003-08-05 18:59:56 +0000
committerJennifer Averett <Jennifer.Averett@OARcorp.com>2003-08-05 18:59:56 +0000
commit2d99235e7e72eaaf6a91c3b395848fa4fd03b14f (patch)
tree86d2ee136b13a34c3812227b6de3a5f8d446b5f6
parentd29cb934abe50d043f3b8d15ae62b81efef1eb4c (diff)
downloadrtems-2d99235e7e72eaaf6a91c3b395848fa4fd03b14f.tar.bz2
2003-08-05 Till Strauman <strauman@slac.stanford.edu>
PR 436/rtems_misc * monitor/mon-monitor.c: monitor registered commands list manipulation bugs
-rw-r--r--cpukit/libmisc/ChangeLog5
-rw-r--r--cpukit/libmisc/monitor/mon-monitor.c40
2 files changed, 20 insertions, 25 deletions
diff --git a/cpukit/libmisc/ChangeLog b/cpukit/libmisc/ChangeLog
index 8416aca5c8..9c74dc4a22 100644
--- a/cpukit/libmisc/ChangeLog
+++ b/cpukit/libmisc/ChangeLog
@@ -1,3 +1,8 @@
+2003-08-05 Till Strauman <strauman@slac.stanford.edu>
+
+ PR 436/rtems_misc
+ * monitor/mon-monitor.c: monitor registered commands list manipulation bugs
+
2003-07-08 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* configure.ac: Remove (Merged into ../configure.ac).
diff --git a/cpukit/libmisc/monitor/mon-monitor.c b/cpukit/libmisc/monitor/mon-monitor.c
index d549925ec4..9d4e2069a6 100644
--- a/cpukit/libmisc/monitor/mon-monitor.c
+++ b/cpukit/libmisc/monitor/mon-monitor.c
@@ -428,22 +428,16 @@ rtems_monitor_insert_cmd (
rtems_monitor_command_entry_t *command
)
{
- rtems_monitor_command_entry_t *p = rtems_registered_commands.next;
+ rtems_monitor_command_entry_t **p = &rtems_registered_commands.next;
command->next = 0;
- if (rtems_registered_commands.next)
- {
- for (; p->next; p = p->next)
- {
- if (STREQ(command->command, p->command))
- return 0;
- }
- p->next = command;
+ while (*p) {
+ if ( STREQ(command->command, (*p)->command) )
+ return 0;
+ p = & (*p)->next;
}
- else
- rtems_registered_commands.next = command;
-
+ *p = command;
return 1;
}
@@ -452,22 +446,18 @@ rtems_monitor_erase_cmd (
rtems_monitor_command_entry_t *command
)
{
- rtems_monitor_command_entry_t *p;
- rtems_monitor_command_entry_t **p_prev = &rtems_registered_commands.next;
-
- if (rtems_registered_commands.next)
- {
- for (p = rtems_registered_commands.next; p->next; p = p->next)
- {
- if (STREQ(command->command, p->command))
- {
- *p_prev = p->next;
- return 1;
- }
- p_prev = &p->next;
+ rtems_monitor_command_entry_t **p = & rtems_registered_commands.next;
+
+ while (*p) {
+ if ( STREQ(command->command, (*p)->command) ) {
+ *p = (*p)->next;
+ command->next = 0;
+ return 1;
}
+ p = & (*p)->next;
}
return 0;
+
}
/*