mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-24 01:31:46 +00:00
clang-tidy: modernize-make-unique
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstring>
|
||||
#include <memory>
|
||||
|
||||
#include <wpi/json.h>
|
||||
#include <wpi/timestamp.h>
|
||||
@@ -423,7 +424,7 @@ std::unique_ptr<Image> SourceImpl::AllocImage(
|
||||
|
||||
// if nothing found, allocate a new buffer
|
||||
if (found < 0) {
|
||||
image.reset(new Image{size});
|
||||
image = std::make_unique<Image>(size);
|
||||
} else {
|
||||
image = std::move(m_imagesAvail[found]);
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <unistd.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
|
||||
#include <wpi/FileSystem.h>
|
||||
#include <wpi/MemAlloc.h>
|
||||
@@ -378,8 +379,8 @@ void UsbCameraImpl::CameraThreadMain() {
|
||||
close(notify_fd);
|
||||
notify_fd = -1;
|
||||
} else {
|
||||
notify_is.reset(new wpi::raw_fd_istream{
|
||||
notify_fd, true, sizeof(struct inotify_event) + NAME_MAX + 1});
|
||||
notify_is = std::make_unique<wpi::raw_fd_istream>(
|
||||
notify_fd, true, sizeof(struct inotify_event) + NAME_MAX + 1);
|
||||
}
|
||||
}
|
||||
bool notified = (notify_fd < 0); // treat as always notified if cannot notify
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "frc/SPI.h"
|
||||
|
||||
#include <cstring>
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
#include <hal/FRCUsageReporting.h>
|
||||
@@ -351,8 +352,9 @@ void SPI::InitAccumulator(units::second_t period, int cmd, int xferSize,
|
||||
SetAutoTransmitData(cmdBytes, xferSize - 4);
|
||||
StartAutoRate(period);
|
||||
|
||||
m_accum.reset(new Accumulator(m_port, xferSize, validMask, validValue,
|
||||
dataShift, dataSize, isSigned, bigEndian));
|
||||
m_accum =
|
||||
std::make_unique<Accumulator>(m_port, xferSize, validMask, validValue,
|
||||
dataShift, dataSize, isSigned, bigEndian);
|
||||
m_accum->m_notifier.StartPeriodic(period * kAccumulateDepth / 2);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user