[pacman-dev] [PATCH v3 2/3] libalpm: export alpm_splitdep and alpm_dep_free
Florian Pritz
bluewind at xinu.at
Tue Sep 16 19:02:13 EDT 2014
Signed-off-by: Florian Pritz <bluewind at xinu.at>
---
I'm not sure where in alpm.g the functions should be, open to suggestions.
lib/libalpm/alpm.h | 2 ++
lib/libalpm/be_local.c | 2 +-
lib/libalpm/be_package.c | 10 +++++-----
lib/libalpm/be_sync.c | 2 +-
lib/libalpm/deps.c | 14 +++++++-------
lib/libalpm/deps.h | 2 --
lib/libalpm/package.c | 2 +-
lib/libalpm/sync.c | 12 ++++++------
8 files changed, 23 insertions(+), 23 deletions(-)
diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h
index 29a2dda..12769a4 100644
--- a/lib/libalpm/alpm.h
+++ b/lib/libalpm/alpm.h
@@ -1554,6 +1554,8 @@ 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);
+alpm_depend_t *alpm_splitdep(const char *depstring);
+void alpm_dep_free(alpm_depend_t *dep);
/* End of alpm_api */
/** @} */
diff --git a/lib/libalpm/be_local.c b/lib/libalpm/be_local.c
index 9a9bdef..731ecf6 100644
--- a/lib/libalpm/be_local.c
+++ b/lib/libalpm/be_local.c
@@ -597,7 +597,7 @@ char *_alpm_local_db_pkgpath(alpm_db_t *db, alpm_pkg_t *info,
if(!feof(fp)) goto error; else break; \
} \
if(_alpm_strip_newline(line, 0) == 0) break; \
- f = alpm_list_add(f, _alpm_splitdep(line)); \
+ f = alpm_list_add(f, alpm_splitdep(line)); \
} while(1) /* note the while(1) and not (0) */
static int local_db_read(alpm_pkg_t *info, alpm_dbinfrq_t inforeq)
diff --git a/lib/libalpm/be_package.c b/lib/libalpm/be_package.c
index 6ec8888..9f0134a 100644
--- a/lib/libalpm/be_package.c
+++ b/lib/libalpm/be_package.c
@@ -216,23 +216,23 @@ static int parse_descfile(alpm_handle_t *handle, struct archive *a, alpm_pkg_t *
/* size in the raw package is uncompressed (installed) size */
newpkg->isize = _alpm_strtoofft(ptr);
} else if(strcmp(key, "depend") == 0) {
- alpm_depend_t *dep = _alpm_splitdep(ptr);
+ alpm_depend_t *dep = alpm_splitdep(ptr);
newpkg->depends = alpm_list_add(newpkg->depends, dep);
} else if(strcmp(key, "optdepend") == 0) {
- alpm_depend_t *optdep = _alpm_splitdep(ptr);
+ alpm_depend_t *optdep = alpm_splitdep(ptr);
newpkg->optdepends = alpm_list_add(newpkg->optdepends, optdep);
} else if(strcmp(key, "makedepend") == 0) {
/* not used atm */
} else if(strcmp(key, "checkdepend") == 0) {
/* not used atm */
} else if(strcmp(key, "conflict") == 0) {
- alpm_depend_t *conflict = _alpm_splitdep(ptr);
+ alpm_depend_t *conflict = alpm_splitdep(ptr);
newpkg->conflicts = alpm_list_add(newpkg->conflicts, conflict);
} else if(strcmp(key, "replaces") == 0) {
- alpm_depend_t *replace = _alpm_splitdep(ptr);
+ alpm_depend_t *replace = alpm_splitdep(ptr);
newpkg->replaces = alpm_list_add(newpkg->replaces, replace);
} else if(strcmp(key, "provides") == 0) {
- alpm_depend_t *provide = _alpm_splitdep(ptr);
+ alpm_depend_t *provide = alpm_splitdep(ptr);
newpkg->provides = alpm_list_add(newpkg->provides, provide);
} else if(strcmp(key, "backup") == 0) {
alpm_backup_t *backup;
diff --git a/lib/libalpm/be_sync.c b/lib/libalpm/be_sync.c
index 4b67f42..296dcc5 100644
--- a/lib/libalpm/be_sync.c
+++ b/lib/libalpm/be_sync.c
@@ -533,7 +533,7 @@ static int _alpm_validate_filename(alpm_db_t *db, const char *pkgname,
#define READ_AND_SPLITDEP(f) do { \
if(_alpm_archive_fgets(archive, &buf) != ARCHIVE_OK) goto error; \
if(_alpm_strip_newline(buf.line, buf.real_line_size) == 0) break; \
- f = alpm_list_add(f, _alpm_splitdep(line)); \
+ f = alpm_list_add(f, alpm_splitdep(line)); \
} while(1) /* note the while(1) and not (0) */
static int sync_db_read(alpm_db_t *db, struct archive *archive,
diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c
index 920753b..0ef5756 100644
--- a/lib/libalpm/deps.c
+++ b/lib/libalpm/deps.c
@@ -35,7 +35,7 @@
#include "handle.h"
#include "trans.h"
-void _alpm_dep_free(alpm_depend_t *dep)
+void SYMEXPORT alpm_dep_free(alpm_depend_t *dep)
{
FREE(dep->name);
FREE(dep->version);
@@ -59,7 +59,7 @@ static alpm_depmissing_t *depmiss_new(const char *target, alpm_depend_t *dep,
void SYMEXPORT alpm_depmissing_free(alpm_depmissing_t *miss)
{
- _alpm_dep_free(miss->depend);
+ alpm_dep_free(miss->depend);
FREE(miss->target);
FREE(miss->causingpkg);
FREE(miss);
@@ -279,12 +279,12 @@ static int no_dep_version(alpm_handle_t *handle)
*/
alpm_pkg_t SYMEXPORT *alpm_find_satisfier(alpm_list_t *pkgs, const char *depstring)
{
- alpm_depend_t *dep = _alpm_splitdep(depstring);
+ alpm_depend_t *dep = alpm_splitdep(depstring);
if(!dep) {
return NULL;
}
alpm_pkg_t *pkg = find_dep_satisfier(pkgs, dep);
- _alpm_dep_free(dep);
+ alpm_dep_free(dep);
return pkg;
}
@@ -455,7 +455,7 @@ int _alpm_depcmp(alpm_pkg_t *pkg, alpm_depend_t *dep)
return _alpm_depcmp_provides(dep, alpm_pkg_get_provides(pkg));
}
-alpm_depend_t *_alpm_splitdep(const char *depstring)
+alpm_depend_t SYMEXPORT *alpm_splitdep(const char *depstring)
{
alpm_depend_t *depend;
const char *ptr, *version, *desc;
@@ -759,10 +759,10 @@ alpm_pkg_t SYMEXPORT *alpm_find_dbs_satisfier(alpm_handle_t *handle,
CHECK_HANDLE(handle, return NULL);
ASSERT(dbs, RET_ERR(handle, ALPM_ERR_WRONG_ARGS, NULL));
- dep = _alpm_splitdep(depstring);
+ dep = alpm_splitdep(depstring);
ASSERT(dep, return NULL);
pkg = resolvedep(handle, dep, dbs, NULL, 1);
- _alpm_dep_free(dep);
+ alpm_dep_free(dep);
return pkg;
}
diff --git a/lib/libalpm/deps.h b/lib/libalpm/deps.h
index f4eadba..bd717bb 100644
--- a/lib/libalpm/deps.h
+++ b/lib/libalpm/deps.h
@@ -27,7 +27,6 @@
#include "package.h"
#include "alpm.h"
-void _alpm_dep_free(alpm_depend_t *dep);
alpm_depend_t *_alpm_dep_dup(const alpm_depend_t *dep);
alpm_list_t *_alpm_sortbydeps(alpm_handle_t *handle,
alpm_list_t *targets, alpm_list_t *ignore, int reverse);
@@ -35,7 +34,6 @@ int _alpm_recursedeps(alpm_db_t *db, alpm_list_t **targs, int include_explicit);
int _alpm_resolvedeps(alpm_handle_t *handle, alpm_list_t *localpkgs, alpm_pkg_t *pkg,
alpm_list_t *preferred, alpm_list_t **packages, alpm_list_t *remove,
alpm_list_t **data);
-alpm_depend_t *_alpm_splitdep(const char *depstring);
int _alpm_depcmp_literal(alpm_pkg_t *pkg, alpm_depend_t *dep);
int _alpm_depcmp_provides(alpm_depend_t *dep, alpm_list_t *provisions);
int _alpm_depcmp(alpm_pkg_t *pkg, alpm_depend_t *dep);
diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c
index a69f454..e2997f6 100644
--- a/lib/libalpm/package.c
+++ b/lib/libalpm/package.c
@@ -630,7 +630,7 @@ cleanup:
static void free_deplist(alpm_list_t *deps)
{
- alpm_list_free_inner(deps, (alpm_list_fn_free)_alpm_dep_free);
+ alpm_list_free_inner(deps, (alpm_list_fn_free)alpm_dep_free);
alpm_list_free(deps);
}
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
index 4c74a3a..545085b 100644
--- a/lib/libalpm/sync.c
+++ b/lib/libalpm/sync.c
@@ -524,8 +524,8 @@ int _alpm_sync_prepare(alpm_handle_t *handle, alpm_list_t **data)
conflict->package1, conflict->package2);
/* if sync1 provides sync2, we remove sync2 from the targets, and vice versa */
- alpm_depend_t *dep1 = _alpm_splitdep(conflict->package1);
- alpm_depend_t *dep2 = _alpm_splitdep(conflict->package2);
+ alpm_depend_t *dep1 = alpm_splitdep(conflict->package1);
+ alpm_depend_t *dep2 = alpm_splitdep(conflict->package2);
if(_alpm_depcmp(sync1, dep2)) {
rsync = sync2;
sync = sync1;
@@ -544,12 +544,12 @@ int _alpm_sync_prepare(alpm_handle_t *handle, alpm_list_t **data)
}
alpm_list_free_inner(deps, (alpm_list_fn_free)alpm_conflict_free);
alpm_list_free(deps);
- _alpm_dep_free(dep1);
- _alpm_dep_free(dep2);
+ alpm_dep_free(dep1);
+ alpm_dep_free(dep2);
goto cleanup;
}
- _alpm_dep_free(dep1);
- _alpm_dep_free(dep2);
+ alpm_dep_free(dep1);
+ alpm_dep_free(dep2);
/* Prints warning */
_alpm_log(handle, ALPM_LOG_WARNING,
--
2.1.0
More information about the pacman-dev
mailing list