| 1627 | } |
| 1628 | |
| 1629 | static void |
| 1630 | expand_list(GListPtr list, char **rsc_list, char **node_list) |
| 1631 | { |
| 1632 | GListPtr gIter = list; |
| 1633 | const char *uname = NULL; |
| 1634 | const char *rsc_id = NULL; |
| 1635 | const char *last_rsc_id = NULL; |
| 1636 | |
| 1637 | if (rsc_list) { |
| 1638 | *rsc_list = NULL; |
| 1639 | } |
| 1640 | |
| 1641 | if (list == NULL) { |
| 1642 | if (rsc_list) { |
| 1643 | *rsc_list = strdup(" "); |
| 1644 | } |
| 1645 | if (node_list) { |
| 1646 | *node_list = strdup(" "); |
| 1647 | } |
| 1648 | return; |
| 1649 | } |
| 1650 | |
| 1651 | if (node_list) { |
| 1652 | *node_list = NULL; |
| 1653 | } |
| 1654 | |
| 1655 | for (; gIter != NULL; gIter = gIter->next) { |
| 1656 | notify_entry_t *entry = (notify_entry_t *) gIter->data; |
| 1657 | |
| 1658 | CRM_CHECK(entry != NULL, continue); |
| 1659 | CRM_CHECK(entry->rsc != NULL, continue); |
| 1660 | CRM_CHECK(node_list == NULL || entry->node != NULL, continue); |
| 1661 | |
| 1662 | uname = NULL; |
| 1663 | rsc_id = entry->rsc->id; |
| 1664 | CRM_ASSERT(rsc_id != NULL); |
| 1665 | |
| 1666 | /* filter dups */ |
| 1667 | if (safe_str_eq(rsc_id, last_rsc_id)) { |
| 1668 | continue; |
| 1669 | } |
| 1670 | last_rsc_id = rsc_id; |
| 1671 | |
| 1672 | if (rsc_list != NULL) { |
| 1673 | int existing_len = 0; |
| 1674 | int len = 2 + strlen(rsc_id); /* +1 space, +1 EOS */ |
| 1675 | |
| 1676 | if (rsc_list && *rsc_list) { |
| 1677 | existing_len = strlen(*rsc_list); |
| 1678 | } |
| 1679 | |
| 1680 | crm_trace("Adding %s (%dc) at offset %d", rsc_id, len - 2, existing_len); |
| 1681 | *rsc_list = realloc(*rsc_list, len + existing_len); |
| 1682 | sprintf(*rsc_list + existing_len, "%s ", rsc_id); |
| 1683 | } |
| 1684 | |
| 1685 | if (entry->node != NULL) { |
| 1686 | uname = entry->node->details->uname; |
no outgoing calls
no test coverage detected