libpkgconf: path: add path list copying function
parent
15efbc249b
commit
43e8c7b44d
|
@ -338,6 +338,7 @@ PKGCONF_API size_t pkgconf_path_build_from_environ(const char *envvarname, const
|
||||||
PKGCONF_API bool pkgconf_path_match_list(const char *path, const pkgconf_list_t *dirlist);
|
PKGCONF_API bool pkgconf_path_match_list(const char *path, const pkgconf_list_t *dirlist);
|
||||||
PKGCONF_API void pkgconf_path_free(pkgconf_list_t *dirlist);
|
PKGCONF_API void pkgconf_path_free(pkgconf_list_t *dirlist);
|
||||||
PKGCONF_API bool pkgconf_path_relocate(char *buf, size_t buflen);
|
PKGCONF_API bool pkgconf_path_relocate(char *buf, size_t buflen);
|
||||||
|
PKGCONF_API void pkgconf_path_copy_list(pkgconf_list_t *dst, const pkgconf_list_t *src);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -222,6 +222,38 @@ pkgconf_path_match_list(const char *path, const pkgconf_list_t *dirlist)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* !doc
|
||||||
|
*
|
||||||
|
* .. c:function:: void pkgconf_path_copy_list(pkgconf_list_t *dst, const pkgconf_list_t *src)
|
||||||
|
*
|
||||||
|
* Copies a path list to another path list.
|
||||||
|
*
|
||||||
|
* :param pkgconf_list_t* dst: The path list to copy to.
|
||||||
|
* :param pkgconf_list_t* src: The path list to copy from.
|
||||||
|
* :return: nothing
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
pkgconf_path_copy_list(pkgconf_list_t *dst, const pkgconf_list_t *src)
|
||||||
|
{
|
||||||
|
pkgconf_node_t *n;
|
||||||
|
|
||||||
|
PKGCONF_FOREACH_LIST_ENTRY(src->head, n)
|
||||||
|
{
|
||||||
|
pkgconf_path_t *srcpath = n->data, *path;
|
||||||
|
|
||||||
|
path = calloc(sizeof(pkgconf_path_t), 1);
|
||||||
|
path->path = strdup(srcpath->path);
|
||||||
|
|
||||||
|
#ifdef PKGCONF_CACHE_INODES
|
||||||
|
path->handle_path = srcpath->handle_path;
|
||||||
|
path->handle_device = srcpath->handle_device;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
pkgconf_node_insert_tail(&path->lnode, path, dst);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* !doc
|
* !doc
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue