From ea828b5693d389d24c744841385b16cb37a32fce Mon Sep 17 00:00:00 2001 From: Nagy Gabor Date: Fri, 25 Jan 2008 21:31:20 +0100 Subject: New _alpm_conflict_dup function Added function to cleanly duplicate a conflict. Signed-off-by: Nagy Gabor Signed-off-by: Chantry Xavier --- lib/libalpm/conflict.c | 11 +++++++++++ lib/libalpm/conflict.h | 1 + 2 files changed, 12 insertions(+) (limited to 'lib') diff --git a/lib/libalpm/conflict.c b/lib/libalpm/conflict.c index 7b4cd0c2..9f6f93da 100644 --- a/lib/libalpm/conflict.c +++ b/lib/libalpm/conflict.c @@ -62,6 +62,17 @@ void _alpm_conflict_free(pmconflict_t *conflict) FREE(conflict); } +pmconflict_t *_alpm_conflict_dup(const pmconflict_t *conflict) +{ + pmconflict_t *newconflict; + CALLOC(newconflict, 1, sizeof(pmconflict_t), RET_ERR(PM_ERR_MEMORY, NULL)); + + STRDUP(newconflict->package1, conflict->package1, RET_ERR(PM_ERR_MEMORY, NULL)); + STRDUP(newconflict->package2, conflict->package2, RET_ERR(PM_ERR_MEMORY, NULL)); + + return(newconflict); +} + int _alpm_conflict_isin(pmconflict_t *needle, alpm_list_t *haystack) { alpm_list_t *i; diff --git a/lib/libalpm/conflict.h b/lib/libalpm/conflict.h index 98a3efe6..71ed579d 100644 --- a/lib/libalpm/conflict.h +++ b/lib/libalpm/conflict.h @@ -36,6 +36,7 @@ struct __pmfileconflict_t { }; pmconflict_t *_alpm_conflict_new(const char *package1, const char *package2); +pmconflict_t *_alpm_conflict_dup(const pmconflict_t *conflict); void _alpm_conflict_free(pmconflict_t *conflict); int _alpm_conflict_isin(pmconflict_t *needle, alpm_list_t *haystack); alpm_list_t *_alpm_innerconflicts(alpm_list_t *packages); -- cgit v1.2.3-24-g4f1b