libpkgconf: pkg_compare_version() becomes pkgconf_compare_version(), same for pkg_scan_all()

feature/tap-sh
William Pitcock 2015-09-06 11:00:46 -05:00
parent 66247fae5f
commit 0d145ef85a
3 changed files with 18 additions and 17 deletions

View File

@ -137,16 +137,17 @@ pkg_t *pkg_ref(pkg_t *pkg);
void pkg_unref(pkg_t *pkg);
void pkg_free(pkg_t *pkg);
pkg_t *pkg_find(const char *name, unsigned int flags);
void pkg_scan_all(pkg_iteration_func_t func);
unsigned int pkg_traverse(pkg_t *root, pkg_traverse_func_t func, void *data, int maxdepth, unsigned int flags);
unsigned int pkg_verify_graph(pkg_t *root, int depth, unsigned int flags);
int pkg_compare_version(const char *a, const char *b);
pkg_t *pkg_verify_dependency(pkgconf_dependency_t *pkgdep, unsigned int flags, unsigned int *eflags);
const char *pkgconf_pkg_get_comparator(pkgconf_dependency_t *pkgdep);
int pkg_cflags(pkg_t *root, pkgconf_list_t *list, int maxdepth, unsigned int flags);
int pkg_libs(pkg_t *root, pkgconf_list_t *list, int maxdepth, unsigned int flags);
pkgconf_pkg_comparator_t pkgconf_pkg_comparator_lookup_by_name(const char *name);
int pkgconf_compare_version(const char *a, const char *b);
void pkgconf_scan_all(pkg_iteration_func_t func);
/* parse.c */
pkg_t *pkg_new_from_file(const char *path, FILE *f, unsigned int flags);
void pkgconf_dependency_parse_str(pkgconf_list_t *deplist_head, const char *depends);

View File

@ -396,7 +396,7 @@ pkg_scan_dir(const char *path, pkg_iteration_func_t func)
}
void
pkg_scan_all(pkg_iteration_func_t func)
pkgconf_scan_all(pkg_iteration_func_t func)
{
pkgconf_node_t *n;
@ -504,12 +504,12 @@ out:
}
/*
* pkg_compare_version(a, b)
* pkgconf_compare_version(a, b)
*
* compare versions using RPM version comparison rules as described in the LSB.
*/
int
pkg_compare_version(const char *a, const char *b)
pkgconf_compare_version(const char *a, const char *b)
{
char oldch1, oldch2;
char buf1[PKG_BUFSIZE], buf2[PKG_BUFSIZE];
@ -665,32 +665,32 @@ static pkgconf_pkg_comparator_name_t pkgconf_pkg_comparator_names[PKG_CMP_SIZE +
static bool pkgconf_pkg_comparator_lt(pkg_t *pkg, pkgconf_dependency_t *pkgdep)
{
return (pkg_compare_version(pkg->version, pkgdep->version) < 0);
return (pkgconf_compare_version(pkg->version, pkgdep->version) < 0);
}
static bool pkgconf_pkg_comparator_gt(pkg_t *pkg, pkgconf_dependency_t *pkgdep)
{
return (pkg_compare_version(pkg->version, pkgdep->version) > 0);
return (pkgconf_compare_version(pkg->version, pkgdep->version) > 0);
}
static bool pkgconf_pkg_comparator_lte(pkg_t *pkg, pkgconf_dependency_t *pkgdep)
{
return (pkg_compare_version(pkg->version, pkgdep->version) <= 0);
return (pkgconf_compare_version(pkg->version, pkgdep->version) <= 0);
}
static bool pkgconf_pkg_comparator_gte(pkg_t *pkg, pkgconf_dependency_t *pkgdep)
{
return (pkg_compare_version(pkg->version, pkgdep->version) >= 0);
return (pkgconf_compare_version(pkg->version, pkgdep->version) >= 0);
}
static bool pkgconf_pkg_comparator_eq(pkg_t *pkg, pkgconf_dependency_t *pkgdep)
{
return (pkg_compare_version(pkg->version, pkgdep->version) == 0);
return (pkgconf_compare_version(pkg->version, pkgdep->version) == 0);
}
static bool pkgconf_pkg_comparator_ne(pkg_t *pkg, pkgconf_dependency_t *pkgdep)
{
return (pkg_compare_version(pkg->version, pkgdep->version) != 0);
return (pkgconf_compare_version(pkg->version, pkgdep->version) != 0);
}
static bool pkgconf_pkg_comparator_any(pkg_t *pkg, pkgconf_dependency_t *pkgdep)

12
main.c
View File

@ -733,7 +733,7 @@ main(int argc, char *argv[])
if (required_pkgconfig_version != NULL)
{
if (pkg_compare_version(PACKAGE_VERSION, required_pkgconfig_version) >= 0)
if (pkgconf_compare_version(PACKAGE_VERSION, required_pkgconfig_version) >= 0)
return EXIT_SUCCESS;
return EXIT_FAILURE;
@ -741,13 +741,13 @@ main(int argc, char *argv[])
if ((want_flags & PKG_LIST) == PKG_LIST)
{
pkg_scan_all(print_list_entry);
pkgconf_scan_all(print_list_entry);
return EXIT_SUCCESS;
}
if ((want_flags & PKG_LIST_PACKAGE_NAMES) == PKG_LIST_PACKAGE_NAMES)
{
pkg_scan_all(print_package_entry);
pkgconf_scan_all(print_package_entry);
return EXIT_SUCCESS;
}
@ -771,7 +771,7 @@ main(int argc, char *argv[])
if (pkg == NULL)
return EXIT_FAILURE;
if (pkg_compare_version(pkg->version, required_module_version) >= 0)
if (pkgconf_compare_version(pkg->version, required_module_version) >= 0)
return EXIT_SUCCESS;
}
@ -798,7 +798,7 @@ main(int argc, char *argv[])
if (pkg == NULL)
return EXIT_FAILURE;
if (pkg_compare_version(pkg->version, required_exact_module_version) == 0)
if (pkgconf_compare_version(pkg->version, required_exact_module_version) == 0)
return EXIT_SUCCESS;
}
@ -825,7 +825,7 @@ main(int argc, char *argv[])
if (pkg == NULL)
return EXIT_FAILURE;
if (pkg_compare_version(pkg->version, required_max_module_version) <= 0)
if (pkgconf_compare_version(pkg->version, required_max_module_version) <= 0)
return EXIT_SUCCESS;
}