forked from ariadne/pkgconf
pkg: add pkg_comparator_lookup_by_name().
parent
ef1f1a3a14
commit
6e4573367d
23
pkg.c
23
pkg.c
|
@ -689,6 +689,29 @@ pkg_get_comparator(pkg_dependency_t *pkgdep)
|
|||
return "???";
|
||||
}
|
||||
|
||||
/*
|
||||
* pkg_comparator_lookup_by_name(name)
|
||||
*
|
||||
* look up the appropriate comparator bytecode in the comparator set (defined
|
||||
* above, see pkg_comparator_names and pkg_comparator_impls).
|
||||
*
|
||||
* XXX: on error return PKG_ANY or maybe we should return PKG_CMP_SIZE which
|
||||
* is poisoned?
|
||||
*/
|
||||
pkg_comparator_t
|
||||
pkg_comparator_lookup_by_name(const char *name)
|
||||
{
|
||||
const pkg_comparator_name_t *i;
|
||||
|
||||
for (i = pkg_comparator_names; i->compare != PKG_CMP_SIZE; i++)
|
||||
{
|
||||
if (!strcmp(i->name, name))
|
||||
return i->compare;
|
||||
}
|
||||
|
||||
return PKG_ANY;
|
||||
}
|
||||
|
||||
/*
|
||||
* pkg_verify_dependency(pkgdep, flags)
|
||||
*
|
||||
|
|
1
pkg.h
1
pkg.h
|
@ -137,6 +137,7 @@ pkg_t *pkg_verify_dependency(pkg_dependency_t *pkgdep, unsigned int flags, unsig
|
|||
const char *pkg_get_comparator(pkg_dependency_t *pkgdep);
|
||||
int pkg_cflags(pkg_t *root, pkg_fragment_t **list, int maxdepth, unsigned int flags);
|
||||
int pkg_libs(pkg_t *root, pkg_fragment_t **list, int maxdepth, unsigned int flags);
|
||||
pkg_comparator_t pkg_comparator_lookup_by_name(const char *name);
|
||||
|
||||
/* parse.c */
|
||||
pkg_t *pkg_new_from_file(const char *path, FILE *f);
|
||||
|
|
Loading…
Reference in New Issue