1
1

Fix a few minor bugs in the coll selection logic -- at least one of

which Torsten ran across last week and I was just now able to
duplicate:
- priority == 0 is still a valid priority
- ensure to not compare against an empty list; if the list is empty,
  just put the selectable item on it without any comparisons
- had wrong argument for ompi_list_get_next() (yay macros with no type
  checking :-( ) that caused badness in some cases

This commit was SVN r4372.
Этот коммит содержится в:
Jeff Squyres 2005-02-10 04:15:16 +00:00
родитель 3532271877
Коммит dd30902bde

Просмотреть файл

@ -354,7 +354,7 @@ static ompi_list_t *check_components(ompi_list_t *components,
if (want_to_check) {
priority = check_one_component(comm, component, &module, &data);
if (priority > 0) {
if (priority >= 0) {
/* We have a component that indicated that it wants to run by
giving us a module */
@ -368,26 +368,32 @@ static ompi_list_t *check_components(ompi_list_t *components,
/* Put this item on the list in priority order (highest
priority first). Should it go first? */
item2 = ompi_list_get_first(selectable);
avail2 = (avail_coll_t *) item2;
if (avail->ac_priority > avail2->ac_priority) {
ompi_list_prepend(selectable, (ompi_list_item_t *) avail);
if (ompi_list_is_empty(selectable)) {
ompi_list_prepend(selectable, (ompi_list_item_t *) avail);
} else {
for (i = 1; item2 != ompi_list_get_end(selectable);
item2 = ompi_list_get_next(selectable), ++i) {
item2 = ompi_list_get_first(selectable);
avail2 = (avail_coll_t *) item2;
if (avail->ac_priority > avail2->ac_priority) {
ompi_list_insert(selectable, (ompi_list_item_t *) avail, i);
break;
}
}
ompi_list_prepend(selectable, (ompi_list_item_t *) avail);
} else {
for (i = 1; item2 != ompi_list_get_end(selectable);
item2 = ompi_list_get_next(item2), ++i) {
avail2 = (avail_coll_t *) item2;
if (avail->ac_priority > avail2->ac_priority) {
ompi_list_insert(selectable,
(ompi_list_item_t *) avail, i);
break;
}
}
/* If we didn't find a place to put it in the list, then
append it (because it has the lowest priority found so
far) */
if (ompi_list_get_end(selectable) == item2) {
ompi_list_append(selectable, (ompi_list_item_t *) avail);
}
/* If we didn't find a place to put it in the list, then
append it (because it has the lowest priority found so
far) */
if (ompi_list_get_end(selectable) == item2) {
ompi_list_append(selectable, (ompi_list_item_t *) avail);
}
}
}
}
}