pkg: add pkg_cflags() for calculating a mergemastered list of cflag fragments for a problem set (issue #11)
parent
40402298ef
commit
e6cf8b4021
22
pkg.c
22
pkg.c
|
@ -647,3 +647,25 @@ pkg_traverse(pkg_t *root,
|
||||||
|
|
||||||
return eflags;
|
return eflags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
pkg_cflags_collect(pkg_t *pkg, void *data, unsigned int flags)
|
||||||
|
{
|
||||||
|
pkg_fragment_t **list = data;
|
||||||
|
pkg_fragment_t *frag;
|
||||||
|
(void) flags;
|
||||||
|
|
||||||
|
PKG_FOREACH_LIST_ENTRY(pkg->cflags, frag)
|
||||||
|
*list = pkg_fragment_copy(*list, frag);
|
||||||
|
}
|
||||||
|
|
||||||
|
pkg_fragment_t *
|
||||||
|
pkg_cflags(pkg_t *root, int maxdepth, unsigned int flags)
|
||||||
|
{
|
||||||
|
pkg_fragment_t *head = NULL;
|
||||||
|
|
||||||
|
pkg_traverse(root, pkg_cflags_collect, &head, maxdepth, flags);
|
||||||
|
|
||||||
|
return head;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
1
pkg.h
1
pkg.h
|
@ -132,6 +132,7 @@ unsigned int pkg_verify_graph(pkg_t *root, int depth, unsigned int flags);
|
||||||
int pkg_compare_version(const char *a, const char *b);
|
int pkg_compare_version(const char *a, const char *b);
|
||||||
pkg_t *pkg_verify_dependency(pkg_dependency_t *pkgdep, unsigned int flags, unsigned int *eflags);
|
pkg_t *pkg_verify_dependency(pkg_dependency_t *pkgdep, unsigned int flags, unsigned int *eflags);
|
||||||
const char *pkg_get_comparator(pkg_dependency_t *pkgdep);
|
const char *pkg_get_comparator(pkg_dependency_t *pkgdep);
|
||||||
|
pkg_fragment_t *pkg_cflags(pkg_t *root, int maxdepth, unsigned int flags);
|
||||||
|
|
||||||
/* parse.c */
|
/* parse.c */
|
||||||
pkg_t *pkg_new_from_file(const char *path, FILE *f);
|
pkg_t *pkg_new_from_file(const char *path, FILE *f);
|
||||||
|
|
Loading…
Reference in New Issue