Skip to content

Commit

Permalink
Sync
Browse files Browse the repository at this point in the history
  • Loading branch information
walbourn committed Sep 17, 2024
1 parent 9c39618 commit 2ab174c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Common/CmdLineHelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@

namespace Helpers
{
struct handle_closer { void operator()(HANDLE h) { if (h) CloseHandle(h); } };

using ScopedHandle = std::unique_ptr<void, handle_closer>;

inline HANDLE safe_handle(HANDLE h) noexcept { return (h == INVALID_HANDLE_VALUE) ? nullptr : h; }

struct find_closer { void operator()(HANDLE h) noexcept { assert(h != INVALID_HANDLE_VALUE); if (h) FindClose(h); } };
Expand Down

0 comments on commit 2ab174c

Please sign in to comment.