mirror of https://gitee.com/bigwinds/arangodb
honor some cppcheck recommendations (#5817)
This commit is contained in:
parent
208f1297e1
commit
2cac8b8a51
|
@ -317,14 +317,14 @@ class Query {
|
|||
|
||||
/// @brief setter for the continue callback:
|
||||
/// We can either have a handler or a callback
|
||||
void setContinueCallback(std::function<void()> cb) {
|
||||
void setContinueCallback(std::function<void()> const& cb) {
|
||||
_continueCallback = cb;
|
||||
_hasHandler = false;
|
||||
}
|
||||
|
||||
/// @brief setter for the continue handler:
|
||||
/// We can either have a handler or a callback
|
||||
void setContinueHandler(std::function<void()> handler) {
|
||||
void setContinueHandler(std::function<void()> const& handler) {
|
||||
_continueCallback = handler;
|
||||
_hasHandler = true;
|
||||
}
|
||||
|
|
|
@ -703,10 +703,8 @@ RestStatus RestAqlHandler::handleUseQuery(std::string const& operation, Query* q
|
|||
VPackObjectBuilder guard(&answerBuilder);
|
||||
if (operation == "lock") {
|
||||
// Mark current thread as potentially blocking:
|
||||
int res = TRI_ERROR_INTERNAL;
|
||||
|
||||
int res = query->trx()->lockCollections();
|
||||
// let exceptions propagate from here
|
||||
res = query->trx()->lockCollections();
|
||||
|
||||
answerBuilder.add(StaticStrings::Error, VPackValue(res != TRI_ERROR_NO_ERROR));
|
||||
answerBuilder.add(StaticStrings::Code, VPackValue(res));
|
||||
|
|
|
@ -208,7 +208,7 @@ Scheduler::~Scheduler() {
|
|||
}
|
||||
|
||||
// do not pass callback by reference, might get deleted before execution
|
||||
void Scheduler::post(std::function<void()> const callback) {
|
||||
void Scheduler::post(std::function<void()> const& callback) {
|
||||
incQueued();
|
||||
|
||||
try {
|
||||
|
@ -229,7 +229,7 @@ void Scheduler::post(std::function<void()> const callback) {
|
|||
|
||||
// do not pass callback by reference, might get deleted before execution
|
||||
void Scheduler::post(asio_ns::io_context::strand& strand,
|
||||
std::function<void()> const callback) {
|
||||
std::function<void()> const& callback) {
|
||||
incQueued();
|
||||
|
||||
try {
|
||||
|
@ -341,7 +341,7 @@ bool Scheduler::pushToFifo(size_t fifo, std::function<void()> const& callback) {
|
|||
size_t p = fifo - 1;
|
||||
TRI_ASSERT(0 < fifo && p < NUMBER_FIFOS);
|
||||
|
||||
std::unique_ptr<FifoJob> job(new FifoJob(callback));
|
||||
auto job = std::make_unique<FifoJob>(callback);
|
||||
|
||||
try {
|
||||
if (0 < _maxFifoSize[p] && (int64_t)_maxFifoSize[p] <= _fifoSize[p]) {
|
||||
|
|
|
@ -91,9 +91,9 @@ class Scheduler {
|
|||
uint64_t _queued;
|
||||
};
|
||||
|
||||
void post(std::function<void()> const callback);
|
||||
void post(std::function<void()> const& callback);
|
||||
void post(asio_ns::io_context::strand&,
|
||||
std::function<void()> const callback);
|
||||
std::function<void()> const& callback);
|
||||
|
||||
bool queue(RequestPriority prio, std::function<void()> const&);
|
||||
void drain();
|
||||
|
@ -175,7 +175,7 @@ class Scheduler {
|
|||
// queue is full
|
||||
|
||||
struct FifoJob {
|
||||
FifoJob(std::function<void()> const& callback) : _callback(callback) {}
|
||||
explicit FifoJob(std::function<void()> const& callback) : _callback(callback) {}
|
||||
std::function<void()> _callback;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue