From b7d480835838f86a3509e8beab9192dcc003853c Mon Sep 17 00:00:00 2001 From: Michael Vrable Date: Sat, 24 Nov 2018 12:55:34 -0800 Subject: [PATCH] Replace boost::scoped_ptr with std::unique_ptr. This is a direct replacement, skipping over the chance to clean up APIs at this point. It does allow us to drop the compile-time dependency on boost, however. --- README | 1 - cumulus.h | 31 ------------------------------- main.cc | 11 ++++++----- store.h | 4 ++-- 4 files changed, 8 insertions(+), 39 deletions(-) delete mode 100644 cumulus.h diff --git a/README b/README index b6345cc..2dec538 100644 --- a/README +++ b/README @@ -13,7 +13,6 @@ Dependencies: http://code.google.com/p/boto - paramiko, SSH2 protocol for python (for sftp storage) http://www.lag.net/paramiko/ - - Boost (smart_ptr) Building should be a simple matter of running "make". This will produce an executable called "cumulus". diff --git a/cumulus.h b/cumulus.h deleted file mode 100644 index 25a95a1..0000000 --- a/cumulus.h +++ /dev/null @@ -1,31 +0,0 @@ -/* Cumulus: Efficient Filesystem Backup to the Cloud - * Copyright (C) 2013 The Cumulus Developers - * See the AUTHORS file for a list of contributors. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -/* Header file with common definitions needed for cumulus. */ - -#ifndef CUMULUS_CUMULUS_H__ -#define CUMULUS_CUMULUS_H__ - -/* All Boost includes are grouped here, so we can more easily switch to other - * implementations in the future. */ -#include - -using boost::scoped_ptr; - -#endif // CUMULUS_CUMULUS_H__ diff --git a/main.cc b/main.cc index 0d02727..1335bea 100644 --- a/main.cc +++ b/main.cc @@ -41,12 +41,12 @@ #include #include #include +#include #include #include #include #include -#include "cumulus.h" #include "exclude.h" #include "hash.h" #include "localdb.h" @@ -62,6 +62,7 @@ using std::map; using std::string; using std::vector; using std::ostream; +using std::unique_ptr; /* Version information. This will be filled in by the Makefile. */ #ifndef CUMULUS_VERSION @@ -227,7 +228,7 @@ int64_t dumpfile(int fd, dictionary &file_info, const string &path, /* If the file is new or changed, we must read in the contents a block at a * time. */ if (!cached) { - scoped_ptr file_hash(Hash::New()); + unique_ptr file_hash(Hash::New()); Subfile subfile(db); subfile.load_old_blocks(old_blocks); @@ -258,7 +259,7 @@ int64_t dumpfile(int fd, dictionary &file_info, const string &path, double block_age = 0.0; ObjectReference ref; - scoped_ptr block_hash(Hash::New()); + unique_ptr block_hash(Hash::New()); block_hash->update(block_buf, bytes); string block_csum = block_hash->digest_str(); @@ -853,7 +854,7 @@ int main(int argc, char *argv[]) dbmeta_filename += backup_scheme + "-"; dbmeta_filename += timestamp + ".meta" + filter_extension; RemoteFile *dbmeta_file = remote->alloc_file(dbmeta_filename, "meta"); - scoped_ptr dbmeta_filter(FileFilter::New(dbmeta_file->get_fd(), + unique_ptr dbmeta_filter(FileFilter::New(dbmeta_file->get_fd(), filter_program)); if (dbmeta_filter == NULL) { fprintf(stderr, "Unable to open descriptor output file: %m\n"); @@ -902,7 +903,7 @@ int main(int argc, char *argv[]) RemoteFile *descriptor_file = remote->alloc_file(desc_filename, "snapshots"); - scoped_ptr descriptor_filter( + unique_ptr descriptor_filter( FileFilter::New(descriptor_file->get_fd(), signature_filter.c_str())); if (descriptor_filter == NULL) { fprintf(stderr, "Unable to open descriptor output file: %m\n"); diff --git a/store.h b/store.h index ab5f8e9..b58ea34 100644 --- a/store.h +++ b/store.h @@ -28,12 +28,12 @@ #include #include +#include #include #include #include #include -#include "cumulus.h" #include "localdb.h" #include "remote.h" #include "ref.h" @@ -123,7 +123,7 @@ private: std::string segment_name; RemoteFile *file; - scoped_ptr filter; + std::unique_ptr filter; // Write data to the tar file void tar_write(const char *data, size_t size); -- 2.20.1