diff options
Diffstat (limited to 'cpukit')
-rw-r--r-- | cpukit/libmisc/ChangeLog | 5 | ||||
-rw-r--r-- | cpukit/libmisc/monitor/mon-monitor.c | 40 |
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; + } /* |