diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2013-07-05 21:54:07 +0900 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2013-07-06 15:56:08 +0900 |
| commit | f8d305fe639a2a458106f3f233f696157c6ab06d (patch) | |
| tree | c55db59952332c1f29e665d44781a82bf2580f83 /src/AbstractSingleDiskAdaptor.cc | |
| parent | 345ba415a50fbf99b1f0049f29be62d0bd11c608 (diff) | |
Use std::unique_ptr for FileAllocationIterator
Diffstat (limited to 'src/AbstractSingleDiskAdaptor.cc')
| -rw-r--r-- | src/AbstractSingleDiskAdaptor.cc | 29 |
1 files changed, 10 insertions, 19 deletions
diff --git a/src/AbstractSingleDiskAdaptor.cc b/src/AbstractSingleDiskAdaptor.cc index f3dbcd17..197f00db 100644 --- a/src/AbstractSingleDiskAdaptor.cc +++ b/src/AbstractSingleDiskAdaptor.cc @@ -145,30 +145,21 @@ void AbstractSingleDiskAdaptor::truncate(int64_t length) diskWriter_->truncate(length); } -std::shared_ptr<FileAllocationIterator> +std::unique_ptr<FileAllocationIterator> AbstractSingleDiskAdaptor::fileAllocationIterator() { switch(getFileAllocationMethod()) { #ifdef HAVE_SOME_FALLOCATE - case(DiskAdaptor::FILE_ALLOC_FALLOC): { - std::shared_ptr<FallocFileAllocationIterator> h - (new FallocFileAllocationIterator - (diskWriter_.get(), size() ,totalLength_)); - return h; - } + case(DiskAdaptor::FILE_ALLOC_FALLOC): + return make_unique<FallocFileAllocationIterator> + (diskWriter_.get(), size() ,totalLength_); #endif // HAVE_SOME_FALLOCATE - case(DiskAdaptor::FILE_ALLOC_TRUNC): { - std::shared_ptr<TruncFileAllocationIterator> h - (new TruncFileAllocationIterator - (diskWriter_.get(), size(), totalLength_)); - return h; - } - default: { - std::shared_ptr<AdaptiveFileAllocationIterator> h - (new AdaptiveFileAllocationIterator - (diskWriter_.get(), size(), totalLength_)); - return h; - } + case(DiskAdaptor::FILE_ALLOC_TRUNC): + return make_unique<TruncFileAllocationIterator> + (diskWriter_.get(), size(), totalLength_); + default: + return make_unique<AdaptiveFileAllocationIterator> + (diskWriter_.get(), size(), totalLength_); } } |
