mirror of
https://github.com/NixOS/nix
synced 2025-06-26 20:01:15 +02:00
Get rid of CBox
This commit is contained in:
parent
5a6d6da7ae
commit
ca87707c90
4 changed files with 10 additions and 46 deletions
|
@ -180,24 +180,4 @@ struct Result
|
|||
}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct CBox
|
||||
{
|
||||
T * ptr;
|
||||
|
||||
T * operator ->()
|
||||
{
|
||||
return ptr;
|
||||
}
|
||||
|
||||
CBox(T * ptr) : ptr(ptr) { }
|
||||
CBox(const CBox &) = delete;
|
||||
CBox(CBox &&) = delete;
|
||||
|
||||
~CBox()
|
||||
{
|
||||
free(ptr);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
extern "C" {
|
||||
rust::Result<std::tuple<>> *
|
||||
unpack_tarfile(rust::Source source, rust::StringSlice dest_dir);
|
||||
unpack_tarfile(rust::Source source, rust::StringSlice dest_dir, rust::Result<std::tuple<>> & out);
|
||||
}
|
||||
|
||||
namespace nix {
|
||||
|
@ -11,7 +11,9 @@ namespace nix {
|
|||
void unpackTarfile(Source & source, const Path & destDir)
|
||||
{
|
||||
rust::Source source2(source);
|
||||
rust::CBox(unpack_tarfile(source2, destDir))->unwrap();
|
||||
rust::Result<std::tuple<>> res;
|
||||
unpack_tarfile(source2, destDir, res);
|
||||
res.unwrap();
|
||||
}
|
||||
|
||||
void unpackTarfile(const Path & tarFile, const Path & destDir,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue