diff options
author | Andrew Gregory <andrew.gregory.8@gmail.com> | 2014-02-03 12:09:18 -0500 |
---|---|---|
committer | Allan McRae <allan@archlinux.org> | 2014-02-04 13:48:37 +1000 |
commit | b9601b1e597c64df9d04678509c31f9bab538fd2 (patch) | |
tree | f4976bded497ef1e5a1d7b41a3b57762202dd95d /lib/libalpm | |
parent | 953808a9ee86fc5bcd63f4458662a5c73ccf37d1 (diff) | |
download | pacman-b9601b1e597c64df9d04678509c31f9bab538fd2.tar.xz |
alpm: export *_free functions
Front-ends should be able to free memory that alpm hands them.
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'lib/libalpm')
-rw-r--r-- | lib/libalpm/alpm.h | 4 | ||||
-rw-r--r-- | lib/libalpm/conflict.c | 6 | ||||
-rw-r--r-- | lib/libalpm/conflict.h | 3 | ||||
-rw-r--r-- | lib/libalpm/deps.c | 8 | ||||
-rw-r--r-- | lib/libalpm/deps.h | 1 | ||||
-rw-r--r-- | lib/libalpm/remove.c | 7 | ||||
-rw-r--r-- | lib/libalpm/sync.c | 16 |
7 files changed, 24 insertions, 21 deletions
diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h index d67d66a0..6a2a1fe5 100644 --- a/lib/libalpm/alpm.h +++ b/lib/libalpm/alpm.h @@ -1351,6 +1351,10 @@ enum alpm_caps { const char *alpm_version(void); enum alpm_caps alpm_capabilities(void); +void alpm_fileconflict_free(alpm_fileconflict_t *conflict); +void alpm_depmissing_free(alpm_depmissing_t *miss); +void alpm_conflict_free(alpm_conflict_t *conflict); + /* End of alpm_api */ /** @} */ diff --git a/lib/libalpm/conflict.c b/lib/libalpm/conflict.c index 369530b7..2611aefc 100644 --- a/lib/libalpm/conflict.c +++ b/lib/libalpm/conflict.c @@ -62,7 +62,7 @@ static alpm_conflict_t *conflict_new(alpm_pkg_t *pkg1, alpm_pkg_t *pkg2, /** * @brief Free a conflict and its members. */ -void _alpm_conflict_free(alpm_conflict_t *conflict) +void SYMEXPORT alpm_conflict_free(alpm_conflict_t *conflict) { FREE(conflict->package2); FREE(conflict->package1); @@ -135,7 +135,7 @@ static int add_conflict(alpm_handle_t *handle, alpm_list_t **baddeps, pkg1->name, pkg2->name, conflict_str); free(conflict_str); } else { - _alpm_conflict_free(conflict); + alpm_conflict_free(conflict); } return 0; } @@ -290,7 +290,7 @@ error: /** * @brief Frees a conflict and its members. */ -void _alpm_fileconflict_free(alpm_fileconflict_t *conflict) +void SYMEXPORT alpm_fileconflict_free(alpm_fileconflict_t *conflict) { FREE(conflict->ctarget); FREE(conflict->file); diff --git a/lib/libalpm/conflict.h b/lib/libalpm/conflict.h index 8cf36ecb..886e9279 100644 --- a/lib/libalpm/conflict.h +++ b/lib/libalpm/conflict.h @@ -25,14 +25,11 @@ #include "package.h" alpm_conflict_t *_alpm_conflict_dup(const alpm_conflict_t *conflict); -void _alpm_conflict_free(alpm_conflict_t *conflict); alpm_list_t *_alpm_innerconflicts(alpm_handle_t *handle, alpm_list_t *packages); alpm_list_t *_alpm_outerconflicts(alpm_db_t *db, alpm_list_t *packages); alpm_list_t *_alpm_db_find_fileconflicts(alpm_handle_t *handle, alpm_list_t *upgrade, alpm_list_t *remove); -void _alpm_fileconflict_free(alpm_fileconflict_t *conflict); - #endif /* _ALPM_CONFLICT_H */ /* vim: set noet: */ diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c index c7dbe1e4..b3de1b00 100644 --- a/lib/libalpm/deps.c +++ b/lib/libalpm/deps.c @@ -57,7 +57,7 @@ static alpm_depmissing_t *depmiss_new(const char *target, alpm_depend_t *dep, return miss; } -void _alpm_depmiss_free(alpm_depmissing_t *miss) +void SYMEXPORT alpm_depmissing_free(alpm_depmissing_t *miss) { _alpm_dep_free(miss->depend); FREE(miss->target); @@ -804,7 +804,7 @@ int _alpm_resolvedeps(alpm_handle_t *handle, alpm_list_t *localpkgs, /* check if one of the packages in the [*packages] list already satisfies * this dependency */ if(find_dep_satisfier(*packages, missdep)) { - _alpm_depmiss_free(miss); + alpm_depmissing_free(miss); continue; } /* check if one of the packages in the [preferred] list already satisfies @@ -818,9 +818,9 @@ int _alpm_resolvedeps(alpm_handle_t *handle, alpm_list_t *localpkgs, _alpm_log(handle, ALPM_LOG_DEBUG, "pulling dependency %s (needed by %s)\n", spkg->name, pkg->name); - _alpm_depmiss_free(miss); + alpm_depmissing_free(miss); } else if(resolvedep(handle, missdep, (targ = alpm_list_add(NULL, handle->db_local)), rem, 0)) { - _alpm_depmiss_free(miss); + alpm_depmissing_free(miss); } else { handle->pm_errno = ALPM_ERR_UNSATISFIED_DEPS; char *missdepstring = alpm_dep_compute_string(missdep); diff --git a/lib/libalpm/deps.h b/lib/libalpm/deps.h index 8a8ff46e..e36bbb38 100644 --- a/lib/libalpm/deps.h +++ b/lib/libalpm/deps.h @@ -29,7 +29,6 @@ void _alpm_dep_free(alpm_depend_t *dep); alpm_depend_t *_alpm_dep_dup(const alpm_depend_t *dep); -void _alpm_depmiss_free(alpm_depmissing_t *miss); alpm_list_t *_alpm_sortbydeps(alpm_handle_t *handle, alpm_list_t *targets, alpm_list_t *ignore, int reverse); int _alpm_recursedeps(alpm_db_t *db, alpm_list_t **targs, int include_explicit); diff --git a/lib/libalpm/remove.c b/lib/libalpm/remove.c index 0afca24e..6fb82eed 100644 --- a/lib/libalpm/remove.c +++ b/lib/libalpm/remove.c @@ -116,7 +116,7 @@ static int remove_prepare_cascade(alpm_handle_t *handle, alpm_list_t *lp) _("could not find %s in database -- skipping\n"), miss->target); } } - alpm_list_free_inner(lp, (alpm_list_fn_free)_alpm_depmiss_free); + alpm_list_free_inner(lp, (alpm_list_fn_free)alpm_depmissing_free); alpm_list_free(lp); lp = alpm_checkdeps(handle, _alpm_db_get_pkgcache(handle->db_local), trans->remove, NULL, 1); @@ -153,7 +153,7 @@ static void remove_prepare_keep_needed(alpm_handle_t *handle, alpm_list_t *lp) _alpm_pkg_free(pkg); } } - alpm_list_free_inner(lp, (alpm_list_fn_free)_alpm_depmiss_free); + alpm_list_free_inner(lp, (alpm_list_fn_free)alpm_depmissing_free); alpm_list_free(lp); lp = alpm_checkdeps(handle, _alpm_db_get_pkgcache(handle->db_local), trans->remove, NULL, 1); @@ -232,7 +232,8 @@ int _alpm_remove_prepare(alpm_handle_t *handle, alpm_list_t **data) if(data) { *data = lp; } else { - alpm_list_free_inner(lp, (alpm_list_fn_free)_alpm_depmiss_free); + alpm_list_free_inner(lp, + (alpm_list_fn_free)alpm_depmissing_free); alpm_list_free(lp); } RET_ERR(handle, ALPM_ERR_UNSATISFIED_DEPS, -1); diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c index 4a76438e..fb133248 100644 --- a/lib/libalpm/sync.c +++ b/lib/libalpm/sync.c @@ -451,7 +451,8 @@ int _alpm_sync_prepare(alpm_handle_t *handle, alpm_list_t **data) dependency-reordered list below */ handle->pm_errno = 0; if(data) { - alpm_list_free_inner(*data, (alpm_list_fn_free)_alpm_depmiss_free); + alpm_list_free_inner(*data, + (alpm_list_fn_free)alpm_depmissing_free); alpm_list_free(*data); *data = NULL; } @@ -527,7 +528,7 @@ int _alpm_sync_prepare(alpm_handle_t *handle, alpm_list_t **data) *data = alpm_list_add(*data, newconflict); } } - alpm_list_free_inner(deps, (alpm_list_fn_free)_alpm_conflict_free); + alpm_list_free_inner(deps, (alpm_list_fn_free)alpm_conflict_free); alpm_list_free(deps); _alpm_dep_free(dep1); _alpm_dep_free(dep2); @@ -545,7 +546,7 @@ int _alpm_sync_prepare(alpm_handle_t *handle, alpm_list_t **data) trans->unresolvable = alpm_list_add(trans->unresolvable, rsync); } - alpm_list_free_inner(deps, (alpm_list_fn_free)_alpm_conflict_free); + alpm_list_free_inner(deps, (alpm_list_fn_free)alpm_conflict_free); alpm_list_free(deps); deps = NULL; @@ -591,13 +592,13 @@ int _alpm_sync_prepare(alpm_handle_t *handle, alpm_list_t **data) *data = alpm_list_add(*data, newconflict); } } - alpm_list_free_inner(deps, (alpm_list_fn_free)_alpm_conflict_free); + alpm_list_free_inner(deps, (alpm_list_fn_free)alpm_conflict_free); alpm_list_free(deps); goto cleanup; } } EVENT(handle, ALPM_EVENT_INTERCONFLICTS_DONE, NULL, NULL); - alpm_list_free_inner(deps, (alpm_list_fn_free)_alpm_conflict_free); + alpm_list_free_inner(deps, (alpm_list_fn_free)alpm_conflict_free); alpm_list_free(deps); } @@ -627,7 +628,8 @@ int _alpm_sync_prepare(alpm_handle_t *handle, alpm_list_t **data) if(data) { *data = deps; } else { - alpm_list_free_inner(deps, (alpm_list_fn_free)_alpm_depmiss_free); + alpm_list_free_inner(deps, + (alpm_list_fn_free)alpm_depmissing_free); alpm_list_free(deps); } goto cleanup; @@ -1273,7 +1275,7 @@ int _alpm_sync_commit(alpm_handle_t *handle, alpm_list_t **data) if(data) { *data = conflict; } else { - alpm_list_free_inner(conflict, (alpm_list_fn_free)_alpm_fileconflict_free); + alpm_list_free_inner(conflict, (alpm_list_fn_free)alpm_fileconflict_free); alpm_list_free(conflict); } RET_ERR(handle, ALPM_ERR_FILE_CONFLICTS, -1); |