/** Adds the pkg1/pkg2 conflict to the baddeps list * @param *baddeps list to add conflict to * @param pkg1 first package * @param pkg2 package causing conflict */ static void add_conflict(alpm_list_t **baddeps, const char *pkg1, const char *pkg2) { pmconflict_t *conflict = _alpm_conflict_new(pkg1, pkg2); if(conflict && !_alpm_conflict_isin(conflict, *baddeps)) { *baddeps = alpm_list_add(*baddeps, conflict); } else { _alpm_conflict_free(conflict); } }
/** * @brief Adds the pkg1/pkg2 conflict to the baddeps list. * * @param handle the context handle * @param baddeps list to add conflict to * @param pkg1 first package * @param pkg2 package causing conflict * @param reason reason for this conflict * * @return 0 on success, -1 on error */ static int add_conflict(alpm_handle_t *handle, alpm_list_t **baddeps, alpm_pkg_t *pkg1, alpm_pkg_t *pkg2, alpm_depend_t *reason) { alpm_conflict_t *conflict = conflict_new(pkg1, pkg2, reason); if(!conflict) { return -1; } if(!conflict_isin(conflict, *baddeps)) { char *conflict_str = alpm_dep_compute_string(reason); *baddeps = alpm_list_add(*baddeps, conflict); _alpm_log(handle, ALPM_LOG_DEBUG, "package %s conflicts with %s (by %s)\n", pkg1->name, pkg2->name, conflict_str); free(conflict_str); } else { _alpm_conflict_free(conflict); } return 0; }