From: Arvin Schnell Date: Thu, 18 Dec 2025 08:43:27 +0000 (+0100) Subject: - reuse code X-Git-Tag: v0.13.1~61^2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b45e75d7c7477e232b53eed0b4d18709d410857b;p=thirdparty%2Fsnapper.git - reuse code --- diff --git a/client/snbk/TheBigThing.cc b/client/snbk/TheBigThing.cc index 2587efac..b139f97a 100644 --- a/client/snbk/TheBigThing.cc +++ b/client/snbk/TheBigThing.cc @@ -136,11 +136,7 @@ namespace snapper // Copy snapshot to target. - const int proto = std::min({ - Uname::supported_proto(), - the_big_things.source_btrfs_version.supported_proto(), - the_big_things.target_btrfs_version.supported_proto() - }); + const int proto = the_big_things.proto(); TheBigThings::const_iterator it1 = the_big_things.find_send_parent(*this); @@ -266,11 +262,7 @@ namespace snapper // Copy snapshot to target. - const int proto = std::min({ - Uname::supported_proto(), - the_big_things.source_btrfs_version.supported_proto(), - the_big_things.target_btrfs_version.supported_proto() - }); + const int proto = the_big_things.proto(); TheBigThings::const_iterator it1 = the_big_things.find_restore_parent(*this); @@ -372,6 +364,17 @@ namespace snapper } + int + TheBigThings::proto() + { + return std::min({ + Uname::supported_proto(), + source_btrfs_version.supported_proto(), + target_btrfs_version.supported_proto() + }); + } + + bool operator<(const TheBigThing& lhs, const TheBigThing& rhs) { diff --git a/client/snbk/TheBigThing.h b/client/snbk/TheBigThing.h index 0aa24dde..140ed749 100644 --- a/client/snbk/TheBigThing.h +++ b/client/snbk/TheBigThing.h @@ -118,6 +118,8 @@ namespace snapper CmdBtrfsVersion source_btrfs_version; CmdBtrfsVersion target_btrfs_version; + int proto(); + private: const ProxySnapper* snapper;