mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-07-17 12:32:17 +02:00
29 lines
564 B
C++
29 lines
564 B
C++
// ArduinoJson - https://arduinojson.org
|
|
// Copyright © 2014-2023, Benoit BLANCHON
|
|
// MIT License
|
|
|
|
#pragma once
|
|
|
|
#include <ArduinoJson/Memory/Allocator.hpp>
|
|
|
|
struct FailingAllocator : ArduinoJson::Allocator {
|
|
static FailingAllocator* instance() {
|
|
static FailingAllocator allocator;
|
|
return &allocator;
|
|
}
|
|
|
|
private:
|
|
FailingAllocator() = default;
|
|
~FailingAllocator() = default;
|
|
|
|
void* allocate(size_t) override {
|
|
return nullptr;
|
|
}
|
|
|
|
void deallocate(void*) override {}
|
|
|
|
void* reallocate(void*, size_t) override {
|
|
return nullptr;
|
|
}
|
|
};
|