forked from bblanchon/ArduinoJson
Reduced size by 52 bytes by inlining createNode()
This commit is contained in:
@ -6,9 +6,10 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "ListIterator.hpp"
|
|
||||||
#include "ListConstIterator.hpp"
|
|
||||||
#include "../JsonBuffer.hpp"
|
#include "../JsonBuffer.hpp"
|
||||||
|
#include "ListConstIterator.hpp"
|
||||||
|
#include "ListIterator.hpp"
|
||||||
|
#include "PlacementNew.hpp"
|
||||||
|
|
||||||
namespace ArduinoJson {
|
namespace ArduinoJson {
|
||||||
namespace Internals {
|
namespace Internals {
|
||||||
@ -48,7 +49,12 @@ class List {
|
|||||||
const_iterator end() const { return const_iterator(NULL); }
|
const_iterator end() const { return const_iterator(NULL); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
node_type *createNode();
|
node_type *createNode() {
|
||||||
|
if (!_buffer) return NULL;
|
||||||
|
void *ptr = _buffer->alloc(sizeof(node_type));
|
||||||
|
return ptr ? new (ptr) node_type() : NULL;
|
||||||
|
}
|
||||||
|
|
||||||
void addNode(node_type *node);
|
void addNode(node_type *node);
|
||||||
void removeNode(node_type *nodeToRemove);
|
void removeNode(node_type *nodeToRemove);
|
||||||
|
|
||||||
|
@ -20,13 +20,6 @@ int List<T>::size() const {
|
|||||||
return nodeCount;
|
return nodeCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
typename List<T>::node_type *List<T>::createNode() {
|
|
||||||
if (!_buffer) return NULL;
|
|
||||||
void *ptr = _buffer->alloc(sizeof(node_type));
|
|
||||||
return ptr ? new (ptr) node_type() : NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void List<T>::addNode(node_type *nodeToAdd) {
|
void List<T>::addNode(node_type *nodeToAdd) {
|
||||||
if (_firstNode) {
|
if (_firstNode) {
|
||||||
|
Reference in New Issue
Block a user