1
1

Correctly handle the case of mixes of character-based names and all-number names

This commit was SVN r24998.
Этот коммит содержится в:
Ralph Castain 2011-08-05 14:37:36 +00:00
родитель 1b402ecb1a
Коммит 3199663613

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

@ -229,29 +229,35 @@ int orte_regex_create(char *nodelist, char **regexp)
OBJ_RELEASE(ndreg);
continue;
}
/* must be at least one */
range = (orte_regex_range_t*)opal_list_get_first(&ndreg->ranges);
/* if there is only one node in the range, then
* just add its name
/* if there is only one range, and it has only one node in it,
* then we don't want to use bracket notation - so treat that
* case separately
*/
if (1 == range->cnt) {
if (NULL != ndreg->suffix) {
if (NULL != ndreg->prefix) {
asprintf(&tmp, "%s%d%s", ndreg->prefix, range->start, ndreg->suffix);
if (1 == opal_list_get_size(&ndreg->ranges)) {
/* must be at least one */
range = (orte_regex_range_t*)opal_list_get_first(&ndreg->ranges);
/* if there is only one node in the range, then
* just add its name
*/
if (1 == range->cnt) {
if (NULL != ndreg->suffix) {
if (NULL != ndreg->prefix) {
asprintf(&tmp, "%s%d%s", ndreg->prefix, range->start, ndreg->suffix);
} else {
asprintf(&tmp, "%d%s", range->start, ndreg->suffix);
}
} else {
asprintf(&tmp, "%d%s", range->start, ndreg->suffix);
}
} else {
if (NULL != ndreg->prefix) {
asprintf(&tmp, "%s%d", ndreg->prefix, range->start);
} else {
asprintf(&tmp, "%d", range->start);
if (NULL != ndreg->prefix) {
asprintf(&tmp, "%s%d", ndreg->prefix, range->start);
} else {
asprintf(&tmp, "%d", range->start);
}
}
opal_argv_append_nosize(&regexargs, tmp);
free(tmp);
OBJ_RELEASE(ndreg);
continue;
}
opal_argv_append_nosize(&regexargs, tmp);
free(tmp);
OBJ_RELEASE(ndreg);
continue;
}
/* start the regex for this nodeid with the prefix */
if (NULL != ndreg->prefix) {
@ -423,6 +429,8 @@ int orte_regex_extract_node_names(char *regexp, char ***names)
free(orig);
return ret;
}
/* step over the comma */
i++;
/* set base equal to the (possible) next base to look at */
base = &base[i];
}