forked from ariadne/pkgconf
libpkgconf: fragment: add pkgconf_fragment_filter() to selectively copy a fragment list using a filter function
parent
0baecbd165
commit
0232ee52a3
|
@ -216,7 +216,7 @@ pkgconf_fragment_exists(pkgconf_list_t *list, const pkgconf_fragment_t *base, un
|
|||
}
|
||||
|
||||
void
|
||||
pkgconf_fragment_copy(pkgconf_list_t *list, pkgconf_fragment_t *base, unsigned int flags, bool is_private)
|
||||
pkgconf_fragment_copy(pkgconf_list_t *list, const pkgconf_fragment_t *base, unsigned int flags, bool is_private)
|
||||
{
|
||||
pkgconf_fragment_t *frag;
|
||||
|
||||
|
@ -233,6 +233,20 @@ pkgconf_fragment_copy(pkgconf_list_t *list, pkgconf_fragment_t *base, unsigned i
|
|||
pkgconf_node_insert_tail(&frag->iter, frag, list);
|
||||
}
|
||||
|
||||
void
|
||||
pkgconf_fragment_filter(const pkgconf_client_t *client, pkgconf_list_t *dest, pkgconf_list_t *src, pkgconf_fragment_filter_func_t filter_func, unsigned int flags)
|
||||
{
|
||||
pkgconf_node_t *node;
|
||||
|
||||
PKGCONF_FOREACH_LIST_ENTRY(src->head, node)
|
||||
{
|
||||
pkgconf_fragment_t *frag = node->data;
|
||||
|
||||
if (filter_func(client, frag, flags))
|
||||
pkgconf_fragment_copy(dest, frag, flags, true);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
pkgconf_fragment_delete(pkgconf_list_t *list, pkgconf_fragment_t *node)
|
||||
{
|
||||
|
|
|
@ -227,11 +227,13 @@ int pkgconf_argv_split(const char *src, int *argc, char ***argv);
|
|||
void pkgconf_argv_free(char **argv);
|
||||
|
||||
/* fragment.c */
|
||||
typedef bool (*pkgconf_fragment_filter_func_t)(const pkgconf_client_t *client, pkgconf_fragment_t *frag, unsigned int flags);
|
||||
void pkgconf_fragment_parse(const pkgconf_client_t *client, pkgconf_list_t *list, pkgconf_list_t *vars, const char *value);
|
||||
void pkgconf_fragment_add(const pkgconf_client_t *client, pkgconf_list_t *list, const char *string);
|
||||
void pkgconf_fragment_copy(pkgconf_list_t *list, pkgconf_fragment_t *base, unsigned int flags, bool is_private);
|
||||
void pkgconf_fragment_copy(pkgconf_list_t *list, const pkgconf_fragment_t *base, unsigned int flags, bool is_private);
|
||||
void pkgconf_fragment_delete(pkgconf_list_t *list, pkgconf_fragment_t *node);
|
||||
void pkgconf_fragment_free(pkgconf_list_t *list);
|
||||
void pkgconf_fragment_filter(const pkgconf_client_t *client, pkgconf_list_t *dest, pkgconf_list_t *src, pkgconf_fragment_filter_func_t filter_func, unsigned int flags);
|
||||
|
||||
/* fileio.c */
|
||||
char *pkgconf_fgetline(char *line, size_t size, FILE *stream);
|
||||
|
|
Loading…
Reference in New Issue