1710 if (ep->serdprops)
1711 lut_free(ep->serdprops, serdprops_destructor, NULL);
1712
1713 /* Free my bubbles */
1714 for (bub = ep->bubbles; bub != NULL; ) {
1715 nextbub = bub->next;
1716 /*
1717 * Free arrows if they are FROM me. Free arrowlists on
1718 * other types of bubbles (but not the attached arrows,
1719 * which will be freed when we free the originating
1720 * bubble.
1721 */
1722 if (bub->t == B_FROM)
1723 itree_free_arrowlists(bub, 1);
1724 else
1725 itree_free_arrowlists(bub, 0);
1726 itree_free_bubble(bub);
1727 bub = nextbub;
1728 }
1729
1730 if (ep->nvp != NULL)
1731 nvlist_free(ep->nvp);
1732 alloc_xfree(ep, sizeof (*ep));
1733 }
1734
1735 /*ARGSUSED*/
1736 static void
1737 itree_pruner(void *left, void *right, void *arg)
1738 {
1739 struct event *ep = (struct event *)right;
1740 struct bubble *nextbub, *bub;
1741
1742 if (ep->keep_in_tree)
1743 return;
1744
1745 /* Free the properties */
1746 lut_free(ep->props, instances_destructor, NULL);
1747
1748 /* Free the payload properties */
1749 lut_free(ep->payloadprops, payloadprops_destructor, NULL);
1750
1751 /* Free the serd properties */
1752 lut_free(ep->serdprops, serdprops_destructor, NULL);
1753
1754 /* Free my bubbles */
1755 for (bub = ep->bubbles; bub != NULL; ) {
1756 nextbub = bub->next;
1757 itree_prune_arrowlists(bub);
1758 itree_free_bubble(bub);
1759 bub = nextbub;
1760 }
1761
1762 if (ep->nvp != NULL)
1763 nvlist_free(ep->nvp);
1764 ep->props = NULL;
1765 ep->payloadprops = NULL;
1766 ep->serdprops = NULL;
1767 ep->bubbles = NULL;
1768 ep->nvp = NULL;
1769 }
1770
1771 static void
1772 itree_free_bubble(struct bubble *freeme)
1773 {
1774 alloc_xfree(freeme, sizeof (*freeme));
1775 }
1776
1777 static struct bubble *
1778 itree_add_bubble(struct event *eventp, enum bubbletype btype, int nork, int gen)
1779 {
1780 struct bubble *prev = NULL;
1781 struct bubble *curr;
1782 struct bubble *newb;
|
1710 if (ep->serdprops)
1711 lut_free(ep->serdprops, serdprops_destructor, NULL);
1712
1713 /* Free my bubbles */
1714 for (bub = ep->bubbles; bub != NULL; ) {
1715 nextbub = bub->next;
1716 /*
1717 * Free arrows if they are FROM me. Free arrowlists on
1718 * other types of bubbles (but not the attached arrows,
1719 * which will be freed when we free the originating
1720 * bubble.
1721 */
1722 if (bub->t == B_FROM)
1723 itree_free_arrowlists(bub, 1);
1724 else
1725 itree_free_arrowlists(bub, 0);
1726 itree_free_bubble(bub);
1727 bub = nextbub;
1728 }
1729
1730 nvlist_free(ep->nvp);
1731 alloc_xfree(ep, sizeof (*ep));
1732 }
1733
1734 /*ARGSUSED*/
1735 static void
1736 itree_pruner(void *left, void *right, void *arg)
1737 {
1738 struct event *ep = (struct event *)right;
1739 struct bubble *nextbub, *bub;
1740
1741 if (ep->keep_in_tree)
1742 return;
1743
1744 /* Free the properties */
1745 lut_free(ep->props, instances_destructor, NULL);
1746
1747 /* Free the payload properties */
1748 lut_free(ep->payloadprops, payloadprops_destructor, NULL);
1749
1750 /* Free the serd properties */
1751 lut_free(ep->serdprops, serdprops_destructor, NULL);
1752
1753 /* Free my bubbles */
1754 for (bub = ep->bubbles; bub != NULL; ) {
1755 nextbub = bub->next;
1756 itree_prune_arrowlists(bub);
1757 itree_free_bubble(bub);
1758 bub = nextbub;
1759 }
1760
1761 nvlist_free(ep->nvp);
1762 ep->props = NULL;
1763 ep->payloadprops = NULL;
1764 ep->serdprops = NULL;
1765 ep->bubbles = NULL;
1766 ep->nvp = NULL;
1767 }
1768
1769 static void
1770 itree_free_bubble(struct bubble *freeme)
1771 {
1772 alloc_xfree(freeme, sizeof (*freeme));
1773 }
1774
1775 static struct bubble *
1776 itree_add_bubble(struct event *eventp, enum bubbletype btype, int nork, int gen)
1777 {
1778 struct bubble *prev = NULL;
1779 struct bubble *curr;
1780 struct bubble *newb;
|