Skip to content

Commit

Permalink
Use std::exchange instead of pom prom
Browse files Browse the repository at this point in the history
  • Loading branch information
syyyr committed Jun 25, 2024
1 parent 6b435f1 commit b51591b
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions libnecrolog/necrolog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <array>
#include <filesystem>
#include <iostream>
#include <utility>

#ifdef __unix
#include <unistd.h>
Expand Down Expand Up @@ -100,9 +101,7 @@ bool NecroLog::shouldLog(Level level, const LogContext &context)

NecroLog::MessageHandler NecroLog::setMessageHandler(NecroLog::MessageHandler h)
{
MessageHandler ret = globalOptions().messageHandler;
globalOptions().messageHandler = h;
return ret;
return std::exchange(globalOptions().messageHandler, h);
}

namespace {
Expand Down

0 comments on commit b51591b

Please sign in to comment.