Ejemplo n.º 1
0
/**
 * @brief Find the items in list `lhs` that are not present in list `rhs`.
 *
 * @param lhs the first list
 * @param rhs the second list
 * @param fn  the comparison function
 *
 * @return a list containing all items in `lhs` not present in `rhs`
 */
alpm_list_t SYMEXPORT *alpm_list_diff(const alpm_list_t *lhs,
		const alpm_list_t *rhs, alpm_list_fn_cmp fn)
{
	alpm_list_t *left, *right;
	alpm_list_t *ret = NULL;

	left = alpm_list_copy(lhs);
	left = alpm_list_msort(left, alpm_list_count(left), fn);
	right = alpm_list_copy(rhs);
	right = alpm_list_msort(right, alpm_list_count(right), fn);

	alpm_list_diff_sorted(left, right, fn, &ret, NULL);

	alpm_list_free(left);
	alpm_list_free(right);
	return ret;
}
Ejemplo n.º 2
0
/**
 * pacman_list_diff_sorted:
 * @lhs: A sorted #PacmanList.
 * @rhs: A sorted #PacmanList.
 * @func: A #GCompareFunc function.
 * @inlhs: Address of a #PacmanList, or %NULL.
 * @inrhs: Address of a #PacmanList, or %NULL.
 *
 * Searches the sorted lists @lhs and @rhs for items that have no equivalent in the other (as determined by @func), and adds these items to @inlhs and @inrhs respectively. Free these lists with pacman_list_free().
 */
void pacman_list_diff_sorted (const PacmanList *lhs, const PacmanList *rhs, GCompareFunc func, PacmanList **inlhs, PacmanList **inrhs) {
	return alpm_list_diff_sorted (lhs, rhs, (alpm_list_fn_cmp) func, inlhs, inrhs);
}