mirror of
https://github.com/eledio-devices/thirdparty-ArduinoJson.git
synced 2025-11-02 00:38:26 +01:00
30 lines
565 B
C++
30 lines
565 B
C++
// ArduinoJson - arduinojson.org
|
|
// Copyright Benoit Blanchon 2014-2020
|
|
// MIT License
|
|
|
|
#pragma once
|
|
|
|
#include <ArduinoJson/Document/BasicJsonDocument.hpp>
|
|
|
|
#include <stdlib.h> // malloc, free
|
|
|
|
namespace ARDUINOJSON_NAMESPACE {
|
|
|
|
struct DefaultAllocator {
|
|
void* allocate(size_t size) {
|
|
return malloc(size);
|
|
}
|
|
|
|
void deallocate(void* ptr) {
|
|
free(ptr);
|
|
}
|
|
|
|
void* reallocate(void* ptr, size_t new_size) {
|
|
return realloc(ptr, new_size);
|
|
}
|
|
};
|
|
|
|
typedef BasicJsonDocument<DefaultAllocator> DynamicJsonDocument;
|
|
|
|
} // namespace ARDUINOJSON_NAMESPACE
|