libstore-c: Add nix_store_path_clone

This commit is contained in:
Robert Hensing 2024-04-08 10:34:58 +02:00
parent 48808a5320
commit 1233bcde37
2 changed files with 13 additions and 0 deletions

View file

@ -132,3 +132,8 @@ void nix_store_path_free(StorePath * sp)
{
delete sp;
}
StorePath * nix_store_path_clone(const StorePath * p)
{
return new StorePath{p->path};
}

View file

@ -90,6 +90,14 @@ nix_err nix_store_get_uri(nix_c_context * context, Store * store, void * callbac
*/
StorePath * nix_store_parse_path(nix_c_context * context, Store * store, const char * path);
/**
* @brief Copy a StorePath
*
* @param[in] p the path to copy
* @return a new StorePath
*/
StorePath * nix_store_path_clone(const StorePath * p);
/** @brief Deallocate a StorePath
*
* Does not fail.