diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2019-12-13 18:29:16 +0100 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2019-12-13 19:05:26 +0100 |
commit | ca87707c90c05289d0c7c1015f5750f6dd93708b (patch) | |
tree | 4364240709b658c599e12b79bff040b72c9afc3e /src | |
parent | 5a6d6da7aea23a48126a77f98612518af66bc203 (diff) |
Get rid of CBox
Diffstat (limited to 'src')
-rw-r--r-- | src/libutil/rust-ffi.hh | 20 | ||||
-rw-r--r-- | src/libutil/tarfile.cc | 6 |
2 files changed, 4 insertions, 22 deletions
diff --git a/src/libutil/rust-ffi.hh b/src/libutil/rust-ffi.hh index a77f83ac5..1466eabec 100644 --- a/src/libutil/rust-ffi.hh +++ b/src/libutil/rust-ffi.hh @@ -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); - } -}; - } diff --git a/src/libutil/tarfile.cc b/src/libutil/tarfile.cc index 79fb9f721..1be0ba24c 100644 --- a/src/libutil/tarfile.cc +++ b/src/libutil/tarfile.cc @@ -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, |