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