From 6e96cb59ec641803b190c7524ff2ed6d5b60b74b Mon Sep 17 00:00:00 2001 From: Tim Wojtulewicz Date: Thu, 10 Jul 2025 16:19:36 -0700 Subject: [PATCH] Move util::Deferred into util-types.h --- src/util-types.h | 12 ++++++++++++ src/util.h | 12 ------------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/util-types.h b/src/util-types.h index da66c2fb3c..11f61b07b8 100644 --- a/src/util-types.h +++ b/src/util-types.h @@ -62,5 +62,17 @@ private: void DoFunc(const std::string& path, bool error_aborts = true); }; +/** + * Helper class that runs a function at destruction. + */ +class Deferred { +public: + Deferred(std::function deferred) : deferred(std::move(deferred)) {} + ~Deferred() { deferred(); } + +private: + std::function deferred; +}; + } // namespace util } // namespace zeek diff --git a/src/util.h b/src/util.h index 429fd11120..5f8bd0fc24 100644 --- a/src/util.h +++ b/src/util.h @@ -622,17 +622,5 @@ inline std::vector split(const wchar_t* s, const wchar_t* del return split(std::wstring_view(s), std::wstring_view(delim)); } -/** - * Helper class that runs a function at destruction. - */ -class Deferred { -public: - Deferred(std::function deferred) : deferred(std::move(deferred)) {} - ~Deferred() { deferred(); } - -private: - std::function deferred; -}; - } // namespace util } // namespace zeek